deepline 0.3.502 → 0.3.504

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 (211) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +26 -0
  2. package/dist/bundling-sources/sdk/src/index.ts +1 -0
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/types.ts +9 -0
  5. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +35 -0
  6. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +1 -1
  7. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +13 -0
  8. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +0 -8
  9. package/dist/bundling-sources/shared_libs/observability/dlq.ts +174 -0
  10. package/dist/bundling-sources/shared_libs/observability/queue-health.ts +9 -0
  11. package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
  12. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +20 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +62 -2
  15. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +667 -62
  16. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +55 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +20 -2
  18. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +46 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/execution-gateway-invocation-fence.ts +80 -4
  20. package/dist/bundling-sources/shared_libs/play-runtime/fixture-egress-fetch.ts +95 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +292 -45
  22. package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +15 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +3 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +7 -3
  25. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +31 -1
  26. package/dist/bundling-sources/shared_libs/play-runtime/post-code-recovery-policy.ts +231 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +4 -0
  28. package/dist/bundling-sources/shared_libs/play-runtime/run-ending-event.ts +55 -0
  29. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +126 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +38 -1
  31. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +2 -9
  32. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +51 -19
  33. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +9 -4
  34. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +2 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +2 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +12 -1
  37. package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +3 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +42 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +7 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +26 -1
  41. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +13 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +53 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +631 -19
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-inventory.ts +719 -0
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts +206 -0
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/latest-cache-result.ts +83 -0
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1432 -157
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +61 -0
  49. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +29 -8
  50. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-queue-health.ts +27 -2
  51. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +45 -0
  52. package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +18 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +129 -14
  54. package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +2 -0
  55. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +10 -1
  56. package/dist/cli/{auth-EFHLOVG4.mjs → auth-3L5AA5AX.mjs} +5 -5
  57. package/dist/cli/auth-UPK4IIIN.js +43 -0
  58. package/dist/cli/{billing-Q5XKEYPP.mjs → billing-E7EASVPO.mjs} +19 -12
  59. package/dist/cli/{billing-SKT2VE34.js → billing-HOGXVE2V.js} +92 -85
  60. package/dist/cli/{chunk-L5CTJY74.mjs → chunk-22OCKCYS.mjs} +2 -2
  61. package/dist/cli/{chunk-YWOQYYYS.mjs → chunk-2ABRDH3B.mjs} +2 -2
  62. package/dist/cli/{chunk-IL666WJE.js → chunk-2W77YCKH.js} +5 -5
  63. package/dist/cli/{chunk-2MVIS2UI.mjs → chunk-3MLFFWDM.mjs} +2 -2
  64. package/dist/cli/{chunk-HMZF2CSP.mjs → chunk-4CC67XH5.mjs} +2 -2
  65. package/dist/cli/{chunk-NXVYLX3F.mjs → chunk-5CHBIJIM.mjs} +10 -6
  66. package/dist/cli/chunk-5LUF4LAR.mjs +209 -0
  67. package/dist/cli/{chunk-JL6H4H3G.js → chunk-5Z6EULD5.js} +6 -6
  68. package/dist/cli/{chunk-32YQBJON.js → chunk-67OI26OE.js} +7 -7
  69. package/dist/cli/{chunk-LA3UYRVZ.js → chunk-6JNBMTCZ.js} +1 -1
  70. package/dist/cli/{chunk-DYHTXGLX.js → chunk-6SMR7LU7.js} +2 -2
  71. package/dist/cli/{chunk-OFBLT2LQ.mjs → chunk-7F4OEHQK.mjs} +1 -1
  72. package/dist/cli/{chunk-DRBD4IYQ.mjs → chunk-7MJYZ33I.mjs} +2 -6
  73. package/dist/cli/{chunk-UOANF3DR.js → chunk-7P2QVMBP.js} +26 -7
  74. package/dist/cli/{chunk-GINKIZ7S.js → chunk-A6LA42JY.js} +16 -16
  75. package/dist/cli/{chunk-FVM4PS5Q.js → chunk-BN5VKY4X.js} +25 -12
  76. package/dist/cli/{chunk-Z2H7OQ6E.mjs → chunk-BTWUNKKX.mjs} +2 -2
  77. package/dist/cli/{chunk-R5F7JXT4.mjs → chunk-BX45XMXZ.mjs} +2 -2
  78. package/dist/cli/{chunk-NKLM4J4X.mjs → chunk-DEAJVQEG.mjs} +1 -1
  79. package/dist/cli/{chunk-JFBJLNBI.js → chunk-FISP4LCK.js} +53 -53
  80. package/dist/cli/{chunk-OEUMXKR5.js → chunk-FTRVCIGC.js} +26 -26
  81. package/dist/cli/{chunk-YL2CCF6T.mjs → chunk-GGBXNQCR.mjs} +4 -4
  82. package/dist/cli/{chunk-YPTZJ7LO.js → chunk-GJ2DA35C.js} +100 -17
  83. package/dist/cli/{chunk-2S2F6YSI.js → chunk-GRAGUYIE.js} +41 -41
  84. package/dist/cli/{chunk-2JS3H6H6.mjs → chunk-HUX5DZO6.mjs} +3 -3
  85. package/dist/cli/{chunk-4CCMD7QM.mjs → chunk-IGNQKOWT.mjs} +32 -15
  86. package/dist/cli/{chunk-WKFAX2K7.js → chunk-IPAMOMGP.js} +21 -21
  87. package/dist/cli/{chunk-SAW3FBCA.mjs → chunk-ITJ7NB2D.mjs} +6 -0
  88. package/dist/cli/{chunk-Q3NM6ZL3.js → chunk-JPR2546F.js} +23 -21
  89. package/dist/cli/{chunk-X5MGQ7UT.js → chunk-KCKAFTPY.js} +10 -10
  90. package/dist/cli/{chunk-TAK3MVXY.js → chunk-KGUGNEKL.js} +284 -267
  91. package/dist/cli/{chunk-OVZOMSH2.js → chunk-LHXYCZYO.js} +8 -8
  92. package/dist/cli/{chunk-QOJBRCAS.js → chunk-MJTK6Q3G.js} +3 -3
  93. package/dist/cli/{chunk-MYUISF3P.mjs → chunk-MLMWM5DV.mjs} +5 -5
  94. package/dist/cli/{chunk-JO5FFSR7.js → chunk-NTLBZUHD.js} +6 -0
  95. package/dist/cli/{chunk-MP5QY4A2.mjs → chunk-NZ7Z7WNM.mjs} +2 -2
  96. package/dist/cli/{chunk-HIVRCTDR.mjs → chunk-OX2D6BG4.mjs} +20 -1
  97. package/dist/cli/{chunk-YDXEXVBV.js → chunk-QKKU2FH4.js} +7 -7
  98. package/dist/cli/{chunk-3KEZVGGV.mjs → chunk-QOLX2O2S.mjs} +4 -4
  99. package/dist/cli/{chunk-JFUXUSKB.mjs → chunk-R2VZVHJP.mjs} +15 -2
  100. package/dist/cli/chunk-R7J7CJPZ.js +209 -0
  101. package/dist/cli/{chunk-XMKUJ44Z.js → chunk-SMSQVRHE.js} +5 -5
  102. package/dist/cli/{chunk-54QXWK3C.mjs → chunk-SVFTZTCI.mjs} +1 -1
  103. package/dist/cli/{chunk-FWDAEWCD.js → chunk-TMQUMILM.js} +19 -23
  104. package/dist/cli/{chunk-TFFJ2PRN.mjs → chunk-UFYJTRSF.mjs} +98 -15
  105. package/dist/cli/{chunk-EUWRKWT4.js → chunk-UJMBG5JU.js} +5 -4
  106. package/dist/cli/{chunk-DKAMCJIT.js → chunk-USTJEEND.js} +17 -13
  107. package/dist/cli/{chunk-AJL2Q6IQ.js → chunk-UXQQPMYO.js} +2 -2
  108. package/dist/cli/{chunk-7ZYSXSJJ.mjs → chunk-VJVJWZ6I.mjs} +5 -5
  109. package/dist/cli/{chunk-JLYDLK6X.js → chunk-WBIDPDKJ.js} +3 -3
  110. package/dist/cli/{chunk-QNELA7SX.js → chunk-WZSFIJMG.js} +53 -53
  111. package/dist/cli/{chunk-NZXB27TP.mjs → chunk-XHZSPMNC.mjs} +4 -4
  112. package/dist/cli/{chunk-W5CHE5Q2.mjs → chunk-Y6XKCEPK.mjs} +1 -1
  113. package/dist/cli/{chunk-4WTC5SSN.mjs → chunk-Y7VEHKID.mjs} +10 -8
  114. package/dist/cli/{chunk-3MJSWVQ2.mjs → chunk-YOQ2NNDO.mjs} +2 -1
  115. package/dist/cli/{chunk-ZNB6GR3P.mjs → chunk-Z6FXUDIL.mjs} +1 -1
  116. package/dist/cli/command-docs.d.mts +2 -1
  117. package/dist/cli/command-docs.d.ts +2 -1
  118. package/dist/cli/command-docs.js +6 -2
  119. package/dist/cli/command-docs.mjs +5 -1
  120. package/dist/cli/{csv-OXGSCV75.js → csv-2XWGPITO.js} +13 -13
  121. package/dist/cli/{csv-6AEPKKCO.mjs → csv-433JEHLQ.mjs} +4 -4
  122. package/dist/cli/{db-K3KRK4CZ.mjs → db-K747DH43.mjs} +6 -6
  123. package/dist/cli/{db-6NVHDUZY.js → db-PJJMD4VH.js} +27 -27
  124. package/dist/cli/describe-OYS7LZJD.js +49 -0
  125. package/dist/cli/{describe-P3ZJS7TQ.mjs → describe-VEDDYW4P.mjs} +20 -20
  126. package/dist/cli/describe-core.d.mts +8 -4
  127. package/dist/cli/describe-core.d.ts +8 -4
  128. package/dist/cli/describe-core.js +4 -4
  129. package/dist/cli/describe-core.mjs +3 -3
  130. package/dist/cli/{executions-2C2FFG52.js → executions-HM5T72H6.js} +8 -8
  131. package/dist/cli/{executions-I7XW6WWK.mjs → executions-JWRX3XCT.mjs} +6 -6
  132. package/dist/cli/{feedback-47B57A5Y.js → feedback-34UG4BO3.js} +8 -8
  133. package/dist/cli/{feedback-RSTNBJAI.mjs → feedback-MNSIA63Y.mjs} +4 -4
  134. package/dist/cli/git-5YQJSJFR.js +25 -0
  135. package/dist/cli/{git-3G5AFKBT.mjs → git-ZKEOXV3A.mjs} +5 -5
  136. package/dist/cli/index.js +144 -142
  137. package/dist/cli/index.mjs +44 -42
  138. package/dist/cli/{legacy-noops-NQ262TKL.mjs → legacy-noops-5M4T4ZVT.mjs} +5 -5
  139. package/dist/cli/{legacy-noops-P665PBG4.js → legacy-noops-YXSI4FVU.js} +8 -8
  140. package/dist/cli/{monitors-KUPZODZS.mjs → monitors-C65OC4AW.mjs} +7 -7
  141. package/dist/cli/{monitors-IPWAD7LS.js → monitors-O25GDOYE.js} +95 -95
  142. package/dist/cli/{org-WFC3N672.js → org-2GSPLY2A.js} +72 -72
  143. package/dist/cli/{org-ZCQGEM3L.mjs → org-ZRMG5NS2.mjs} +6 -6
  144. package/dist/cli/{pages-N5BNC67L.js → pages-45DPADK6.js} +18 -18
  145. package/dist/cli/{pages-VE66IU7B.mjs → pages-TZZUFBRO.mjs} +6 -6
  146. package/dist/cli/{play-EIMDIAJB.mjs → play-3D7HH273.mjs} +138 -226
  147. package/dist/cli/{play-NKIRJSKX.js → play-RCGMND6X.js} +454 -542
  148. package/dist/cli/{providers-XU3AGY2F.js → providers-3N3ECMTY.js} +9 -9
  149. package/dist/cli/{providers-KDTJ63ED.mjs → providers-PSAKV6CJ.mjs} +6 -6
  150. package/dist/cli/{quickstart-TXFXUODF.mjs → quickstart-2A35SMGC.mjs} +4 -4
  151. package/dist/cli/{quickstart-OSCHOSXU.js → quickstart-6R6AIXM6.js} +6 -6
  152. package/dist/cli/{run-ODGML35U.mjs → run-F3TLDGUO.mjs} +25 -25
  153. package/dist/cli/{run-ET2KVTPK.js → run-F6ZXTASZ.js} +44 -44
  154. package/dist/cli/{search-DK67K6PR.mjs → search-CZLCY3D2.mjs} +7 -7
  155. package/dist/cli/search-R5VEWJO2.js +32 -0
  156. package/dist/cli/{search-output-6SOKQTCW.mjs → search-output-MQTSTLN5.mjs} +5 -5
  157. package/dist/cli/{search-output-KXP4FA62.js → search-output-R5XDNILW.js} +7 -7
  158. package/dist/cli/{secrets-C6SYTMU7.mjs → secrets-D3GF4B2Z.mjs} +6 -6
  159. package/dist/cli/{secrets-WPS6NMNK.js → secrets-DCJYHDSY.js} +15 -15
  160. package/dist/cli/{sessions-PXVOH34X.mjs → sessions-QGEQ2UYZ.mjs} +5 -5
  161. package/dist/cli/{sessions-IP562J5Z.js → sessions-Z4JYJSDP.js} +6 -6
  162. package/dist/cli/{settings-FBUQGYVJ.mjs → settings-G7QEXA4N.mjs} +11 -11
  163. package/dist/cli/{settings-SUDUIVMY.js → settings-UVXXAT4A.js} +78 -78
  164. package/dist/cli/{setup-I5H6IOEY.js → setup-5I42W7D4.js} +49 -49
  165. package/dist/cli/{setup-JSIMTR73.mjs → setup-QHJU3DUI.mjs} +9 -9
  166. package/dist/cli/{skills-FJQ3LX6N.mjs → skills-5LRF4UKX.mjs} +7 -7
  167. package/dist/cli/skills-FB6TV52O.js +36 -0
  168. package/dist/cli/tools-L2364RPA.js +56 -0
  169. package/dist/cli/{tools-IGBK4BVE.mjs → tools-PUT6STVG.mjs} +18 -18
  170. package/dist/cli/{update-7MTT6F5K.mjs → update-CJ2GA64X.mjs} +9 -9
  171. package/dist/cli/update-ESYJGYVZ.js +34 -0
  172. package/dist/cli/{workflow-PM2J2OU3.mjs → workflow-HVEWRTXD.mjs} +7 -7
  173. package/dist/cli/{workflow-UX3ZX6BQ.js → workflow-O67MEBCP.js} +17 -17
  174. package/dist/{client-Bn8FwKGO.d.ts → client-CIwenMFS.d.ts} +1 -1
  175. package/dist/{client-CfNRmjLK.d.mts → client-DYAfJpaN.d.mts} +1 -1
  176. package/dist/{client-core-B91EV0WS.d.ts → client-core-CRjtyMAI.d.ts} +25 -2
  177. package/dist/{client-core-BG8Cgrmk.d.mts → client-core-DlzP8vEs.d.mts} +25 -2
  178. package/dist/{compiler-manifest-DlXDyndN.d.mts → compiler-manifest-DaJrA2KV.d.mts} +1 -1
  179. package/dist/{compiler-manifest-DlXDyndN.d.ts → compiler-manifest-DaJrA2KV.d.ts} +1 -1
  180. package/dist/{errors-BtriA2ld.d.mts → errors-BKnSYueU.d.mts} +1 -1
  181. package/dist/{errors-DmcLykM7.d.ts → errors-KLga4bLr.d.ts} +1 -1
  182. package/dist/{index-DI0sR_fX.d.mts → index-C-8AFpWy.d.mts} +1 -1
  183. package/dist/{index--Jw-slHY.d.ts → index-C5nAZ-VS.d.ts} +1 -1
  184. package/dist/index.d.mts +7 -7
  185. package/dist/index.d.ts +7 -7
  186. package/dist/index.js +9 -9
  187. package/dist/index.mjs +6 -6
  188. package/dist/install-integrity.json +125 -116
  189. package/dist/plays/bundle-play-file.d.mts +3 -3
  190. package/dist/plays/bundle-play-file.d.ts +3 -3
  191. package/dist/plays/bundle-play-file.mjs +12 -5
  192. package/dist/plays/play-description.d.mts +2 -2
  193. package/dist/plays/play-description.d.ts +2 -2
  194. package/dist/plays/run-request.d.mts +2 -2
  195. package/dist/plays/run-request.d.ts +2 -2
  196. package/dist/release.d.mts +1 -1
  197. package/dist/release.d.ts +1 -1
  198. package/dist/release.js +2 -2
  199. package/dist/release.mjs +1 -1
  200. package/dist/server.d.mts +4 -4
  201. package/dist/server.d.ts +4 -4
  202. package/dist/server.js +5 -5
  203. package/dist/server.mjs +3 -3
  204. package/package.json +1 -1
  205. package/dist/cli/auth-VM3IKP5F.js +0 -43
  206. package/dist/cli/describe-JOUAXXPE.js +0 -49
  207. package/dist/cli/git-OPKIC6JQ.js +0 -25
  208. package/dist/cli/search-6U54Y3OK.js +0 -32
  209. package/dist/cli/skills-VHININXC.js +0 -36
  210. package/dist/cli/tools-XMBMHVKF.js +0 -56
  211. package/dist/cli/update-H7JVW43I.js +0 -34
@@ -73,6 +73,7 @@ import {
73
73
  type RuntimeReceiptValuePersister,
74
74
  type RuntimeReceiptValueReader,
75
75
  } from './runtime-receipt-value-storage';
76
+ import { publishPostgresLatestCacheResult } from './latest-cache-result';
76
77
 
77
78
  type RuntimeReceiptActionWithOptionalScope<
78
79
  TAction extends RuntimeReceiptAction = RuntimeReceiptAction,
@@ -109,6 +110,7 @@ export const RECEIPT_GATEWAY_ACTIONS = new Set<string>([
109
110
  'heartbeat_runtime_step_receipts',
110
111
  'skip_runtime_step_receipt',
111
112
  'observe_docflow_node',
113
+ 'publish_latest_cache_result',
112
114
  ]);
113
115
 
114
116
  /** Run/play scope already proven by the transport's executor-token auth. */
@@ -1546,6 +1548,65 @@ export function createReceiptGatewayDispatcher(input: {
1546
1548
  ),
1547
1549
  );
1548
1550
  }
1551
+ case 'publish_latest_cache_result': {
1552
+ const key = receiptKey(body.key);
1553
+ if (key instanceof Response) return key;
1554
+ const keyScopeError = dispatchOptions.validateKeys?.([key]);
1555
+ if (keyScopeError) return keyScopeError;
1556
+ // Only shared read cache rows are newest-wins. Every other receipt
1557
+ // stays write-once, so refuse any key outside this org's cache.
1558
+ if (!key.startsWith(`ctx:${scope.orgId}:cache:v1:`)) {
1559
+ return receiptGatewayJsonResponse(
1560
+ {
1561
+ error:
1562
+ 'Shared read cache publish requires a ctx:{org}:cache:v1 key in the executor org.',
1563
+ },
1564
+ { status: 403 },
1565
+ );
1566
+ }
1567
+ const output = body.output as unknown;
1568
+ if (
1569
+ !output ||
1570
+ typeof output !== 'object' ||
1571
+ Array.isArray(output) ||
1572
+ (output as { kind?: unknown }).kind !== 'latest_cache_result'
1573
+ ) {
1574
+ return receiptGatewayJsonResponse(
1575
+ {
1576
+ error:
1577
+ 'Shared read cache publish requires a latest_cache_result entry.',
1578
+ },
1579
+ { status: 400 },
1580
+ );
1581
+ }
1582
+ // The database stamps the time; a caller-supplied one is dropped.
1583
+ const { recordedAtMs: _callerTime, ...entry } = output as Record<
1584
+ string,
1585
+ unknown
1586
+ >;
1587
+ const sanitized = sanitizeRuntimeReceiptPayloadForStorage(entry);
1588
+ if (sanitized.bytes > inlineMaxBytes) {
1589
+ return receiptGatewayJsonResponse({
1590
+ published: false,
1591
+ reason: 'value_too_large',
1592
+ });
1593
+ }
1594
+ const published = await publishPostgresLatestCacheResult(
1595
+ client,
1596
+ {
1597
+ orgId: scope.orgId,
1598
+ key,
1599
+ runId,
1600
+ outputJson: sanitized.serialized,
1601
+ },
1602
+ { schema: input.schema },
1603
+ );
1604
+ return receiptGatewayJsonResponse(
1605
+ published.published
1606
+ ? published
1607
+ : { published: false, reason: 'older' },
1608
+ );
1609
+ }
1549
1610
  case 'observe_docflow_node': {
1550
1611
  // ADR 0016 rule 2: durable per-node-invocation observation on the
1551
1612
  // same wire receipts use. The play body fires this fire-and-forget,
@@ -91,7 +91,7 @@ const RUNTIME_EVENT_LOG_POSITION_EXPRESSION = `jsonb_set(
91
91
  // Migration readiness tracks this projection body independently of scheduler
92
92
  // wire and schema versions. Bump when a changed trigger must be reinstalled.
93
93
  export const RUNTIME_EVENT_SEARCH_OUTBOX_PROJECTION_MARKER =
94
- 'runtime-event-search-legacy-position-resolver-pools';
94
+ 'runtime-event-search-epoch-resume-lifecycle';
95
95
  /** Trusted trigger-authored state; absent on already-projected legacy rows. */
96
96
  export const RUNTIME_EVENT_DEFERRED_PROJECTION_FIELD =
97
97
  '_runtimeSearchProjectionPending';
@@ -2794,6 +2794,7 @@ export async function attachRuntimeEventSearchTriggers(
2794
2794
  recent_log_keys jsonb := '{}'::jsonb; dedupe_key text;
2795
2795
  terminal_overlap_counts jsonb := '{}'::jsonb;
2796
2796
  recent_log_keys_loaded boolean := false; recent_log_attempt text;
2797
+ epoch_resume boolean; lifecycle_at timestamptz;
2797
2798
  BEGIN
2798
2799
  -- Log ordering owns a transaction-scoped mutex, independent of the
2799
2800
  -- scheduler's Run/attempt row-lock order. In particular, old completion
@@ -3285,29 +3286,49 @@ export async function attachRuntimeEventSearchTriggers(
3285
3286
  END IF;
3286
3287
  END LOOP;
3287
3288
  END IF;
3289
+ -- A same-run resume of a failed or cancelled run is the kindless
3290
+ -- run.resumed fact whose identity names its epoch
3291
+ -- (run-resumed:{runId}:{epoch}). Durable-wait wakes share the kind but
3292
+ -- use a random identity, so this matches epoch resumes only.
3293
+ epoch_resume := coalesce(observation.event_type = ${RUN_EVENT_KIND_SQL_LITERAL.runResumed}
3294
+ AND jsonb_typeof(observation.payload_json) = 'object'
3295
+ AND NOT (observation.payload_json ? 'kind')
3296
+ AND jsonb_typeof(observation.payload_json->'epoch') = 'number'
3297
+ AND (observation.payload_json->>'epoch') ~ '^[1-9][0-9]{0,8}$'
3298
+ AND observation.event_id = 'run-resumed:' || observation.run_id || ':' || (observation.payload_json->>'epoch'), false);
3299
+ lifecycle_at := CASE WHEN epoch_resume
3300
+ AND jsonb_typeof(observation.payload_json->'resumedAtMs') = 'number'
3301
+ AND coalesce((observation.payload_json->>'resumedAtMs') ~ '^[0-9]{12,14}$', false)
3302
+ THEN to_timestamp((observation.payload_json->>'resumedAtMs')::double precision / 1000)
3303
+ ELSE observation.created_at END;
3304
+ -- Wait and wake carriers are indexed only when they name a non-detached
3305
+ -- kind; a kindless one stays unindexed unless it is an epoch resume.
3288
3306
  IF observation.event_type IN (${RUN_EVENT_LIFECYCLE_KIND_SQL_LIST})
3289
- AND NOT (observation.event_type IN (
3290
- ${RUN_EVENT_KIND_SQL_LITERAL.runWaiting},
3291
- ${RUN_EVENT_KIND_SQL_LITERAL.runResumed}
3292
- )
3293
- AND observation.payload_json->>'kind' = 'detached_runner') THEN
3307
+ AND (epoch_resume
3308
+ OR observation.event_type NOT IN (
3309
+ ${RUN_EVENT_KIND_SQL_LITERAL.runWaiting},
3310
+ ${RUN_EVENT_KIND_SQL_LITERAL.runResumed}
3311
+ )
3312
+ OR coalesce(observation.payload_json->>'kind' <> 'detached_runner', false)) THEN
3294
3313
  INSERT INTO runtime_observability.events (
3295
3314
  runtime_scope, org_id, event_id, event_seq, event_payload,
3296
3315
  occurred_at, run_id, play_name, kind, search_doc
3297
3316
  ) VALUES (
3298
3317
  ${quoteLiteral(scope)}, run_org, observation.event_id,
3299
3318
  CASE WHEN canonical_events THEN nextval('runtime_observability.runtime_event_order_seq') END,
3319
+ -- Bounded projection: the resume's requester is never copied.
3300
3320
  CASE WHEN canonical_events THEN jsonb_strip_nulls(jsonb_build_object(
3301
3321
  'type', observation.event_type, 'runId', observation.run_id,
3302
- 'occurredAt', floor(extract(epoch FROM observation.created_at) * 1000)::bigint,
3322
+ 'occurredAt', floor(extract(epoch FROM lifecycle_at) * 1000)::bigint,
3303
3323
  'source', 'system', 'playName', play,
3324
+ 'epoch', CASE WHEN epoch_resume THEN observation.payload_json->'epoch' END,
3304
3325
  'status', observation.payload_json->>'status',
3305
3326
  'error', observation.payload_json->>'error',
3306
3327
  'waitKind', observation.payload_json->>'waitKind',
3307
3328
  'waitUntil', observation.payload_json->'waitUntil',
3308
3329
  'resultSummary', observation.payload_json->'resultSummary'
3309
3330
  )) END,
3310
- observation.created_at,
3331
+ lifecycle_at,
3311
3332
  observation.run_id, play, observation.event_type, jsonb_build_object('kind', observation.event_type, 'source', 'system')
3312
3333
  ) ON CONFLICT DO NOTHING;
3313
3334
  END IF;
@@ -16,6 +16,7 @@ import {
16
16
  getDlqTransitionPaths,
17
17
  type DlqInventory,
18
18
  } from '../../observability/dlq';
19
+ import { durableRunsHealthProjectionSql } from './durable-run-sql';
19
20
 
20
21
  /**
21
22
  * Bounded, read-only health projection for the durable runtime queues.
@@ -66,7 +67,13 @@ export type RuntimeQueueFlow = {
66
67
 
67
68
  export type RuntimeQueueHealthProjection = {
68
69
  id: string;
69
- kind: 'absurd' | 'run_ledger_outbox' | 'compute_billing' | 'sandbox_cleanup';
70
+ kind:
71
+ | 'absurd'
72
+ | 'run_ledger_outbox'
73
+ | 'compute_billing'
74
+ | 'sandbox_cleanup'
75
+ /** Inventory of durable Play runs: queued, recovering and in flight. */
76
+ | 'durable_runs';
70
77
  source: 'absurd' | 'runtime_postgres';
71
78
  observedAt: string;
72
79
  status: RuntimeQueueHealthStatus;
@@ -417,7 +424,9 @@ function projectionFromRow(input: {
417
424
  ? 'Deliver causal Run Ledger events to control-plane projections'
418
425
  : input.kind === 'compute_billing'
419
426
  ? 'Settle durable compute billing obligations after a runtime run ends'
420
- : 'Complete durable sandbox deletion obligations',
427
+ : input.kind === 'durable_runs'
428
+ ? 'Show in-flight, automatically recovering, and resumable Play runs'
429
+ : 'Complete durable sandbox deletion obligations',
421
430
  unit: 'items',
422
431
  kind: input.kind === 'absurd' ? 'fifo' : 'leased_workset',
423
432
  ageSlo: {
@@ -1052,6 +1061,12 @@ export async function readRuntimeQueueHealthFromClient(
1052
1061
  cleanupProjectionQuery(schema, input.includeRetirementCandidates === true),
1053
1062
  [now, sampleLimit + 1, sampleLimit],
1054
1063
  );
1064
+ const durableRuns = await client.query<CountRow>(
1065
+ durableRunsHealthProjectionSql({
1066
+ schema: input.schema?.trim() || 'runtime_scheduler',
1067
+ }),
1068
+ [now, sampleLimit + 1, sampleLimit],
1069
+ );
1055
1070
  projections.push(
1056
1071
  projectionFromRow({
1057
1072
  id: 'runtime:run-ledger-outbox',
@@ -1083,6 +1098,16 @@ export async function readRuntimeQueueHealthFromClient(
1083
1098
  options,
1084
1099
  includeRetirementCandidates: input.includeRetirementCandidates,
1085
1100
  }),
1101
+ projectionFromRow({
1102
+ id: 'runtime:durable-play-runs',
1103
+ kind: 'durable_runs',
1104
+ source: 'runtime_postgres',
1105
+ row: rowFromResult(durableRuns),
1106
+ observedAt: now,
1107
+ environment: input.environment,
1108
+ options,
1109
+ includeRetirementCandidates: input.includeRetirementCandidates,
1110
+ }),
1086
1111
  );
1087
1112
  const summary = {
1088
1113
  green: projections.filter((p) => p.status === 'green').length,
@@ -250,6 +250,51 @@ export function resolveRunnerHeartbeatSilenceMs(
250
250
  );
251
251
  }
252
252
 
253
+ /**
254
+ * Milliseconds after a detached runner parks before the worker deletes its
255
+ * sandbox, as a provider outage would; zero when the fault is absent. The
256
+ * same Production guard as {@link resolveRunnerHeartbeatSilenceMs} applies.
257
+ */
258
+ export function resolveRunnerSandboxDeleteMs(
259
+ runtimeTestFaultHeader: string | null | undefined,
260
+ ): number {
261
+ if (
262
+ getRuntimeEnv() === 'prod' &&
263
+ process.env.DEEPLINE_RUNTIME_ENVIRONMENT !== 'preview'
264
+ ) {
265
+ return 0;
266
+ }
267
+ return recognizedRuntimeTestFaultCount(
268
+ runtimeTestFaultHeader,
269
+ 'runner_sandbox_delete_ms',
270
+ );
271
+ }
272
+
273
+ /** Longest stale window the gateway-crash fault may set. */
274
+ const FENCE_COMMIT_ABANDON_MAX_MS = 10 * 60_000;
275
+
276
+ /**
277
+ * How long a call abandoned by the gateway-crash test fault stays running
278
+ * before it is unknown; 0 when the fault is absent or this is Production.
279
+ */
280
+ export function resolveFenceCommitAbandonMs(
281
+ runtimeTestFaultHeader: string | null | undefined,
282
+ ): number {
283
+ if (
284
+ getRuntimeEnv() === 'prod' &&
285
+ process.env.DEEPLINE_RUNTIME_ENVIRONMENT !== 'preview'
286
+ ) {
287
+ return 0;
288
+ }
289
+ return Math.min(
290
+ FENCE_COMMIT_ABANDON_MAX_MS,
291
+ recognizedRuntimeTestFaultCount(
292
+ runtimeTestFaultHeader,
293
+ 'fence_commit_abandon_ms',
294
+ ),
295
+ );
296
+ }
297
+
253
298
  export function runtimeSheetPageTailRowsContainTarget(
254
299
  rows: readonly unknown[],
255
300
  ): boolean {
@@ -15,6 +15,24 @@ export function isAlwaysFreshIntegrationTool(toolId: string): boolean {
15
15
  return ALWAYS_FRESH_INTEGRATION_TOOL_IDS.has(toolId.trim());
16
16
  }
17
17
 
18
+ /** The always-fresh tools that only read reviewer-owned state. */
19
+ const ALWAYS_FRESH_INTEGRATION_READ_TOOL_IDS = new Set([
20
+ 'google_workspace_request',
21
+ ]);
22
+
23
+ /**
24
+ * An always-fresh tool that writes. Its result is never reused by another
25
+ * call or run, but a retry of the same run must recover it rather than write
26
+ * again, so it records the run's history row like any other call.
27
+ */
28
+ export function isAlwaysFreshIntegrationWriteTool(toolId: string): boolean {
29
+ const id = toolId.trim();
30
+ return (
31
+ ALWAYS_FRESH_INTEGRATION_TOOL_IDS.has(id) &&
32
+ !ALWAYS_FRESH_INTEGRATION_READ_TOOL_IDS.has(id)
33
+ );
34
+ }
35
+
18
36
  /**
19
37
  * Whether a completed result may serve a later call. The Play runner, `tools
20
38
  * get` and Play admission all ask this one function, so an author is never told
@@ -1,3 +1,4 @@
1
+ import { DURABLE_RUNS_ROLLOUT } from './durable-runs-rollout';
1
2
  import { RUNNER_GATEWAY_CONNECTION_RETRY_BUDGET_MS } from './runtime-constants';
2
3
  import {
3
4
  isHardBillingToolHttpError,
@@ -269,6 +270,7 @@ export type ToolExecuteHttpRetryDecision = {
269
270
  | 'retry_safe_transient_5xx'
270
271
  | 'edge_gateway_transient'
271
272
  | 'unsafe_transient_5xx'
273
+ | 'provider_server_error'
272
274
  | 'hard_billing_error'
273
275
  | 'non_retryable_status';
274
276
  };
@@ -368,6 +370,29 @@ function isGatewayInvocationInProgressResponse(input: {
368
370
  );
369
371
  }
370
372
 
373
+ /** How long past an abandoned call's stale time a newer attempt keeps waiting. */
374
+ const OLDER_ATTEMPT_CALL_STALE_GRACE_MS = 60_000;
375
+ const OLDER_ATTEMPT_CALL_POLL_MAX_MS = 30_000;
376
+
377
+ /**
378
+ * When the gateway reports the call still running for an older attempt of
379
+ * this run, the time that call becomes stale (and the fence lets this
380
+ * attempt send it again with the same key). Waiting until then is a
381
+ * platform wait, not a failure of the row.
382
+ */
383
+ function olderAttemptCallStaleAtMs(input: {
384
+ status: number;
385
+ bodyText: string;
386
+ }): number | null {
387
+ if (!isGatewayInvocationInProgressResponse(input)) return null;
388
+ const body = parseJsonObject(input.bodyText);
389
+ return body?.owner_attempt_older === true &&
390
+ typeof body.stale_at_ms === 'number' &&
391
+ Number.isFinite(body.stale_at_ms)
392
+ ? body.stale_at_ms
393
+ : null;
394
+ }
395
+
371
396
  function isCustomerDbStorageUnavailableResponse(input: {
372
397
  toolId: string;
373
398
  status: number;
@@ -477,6 +502,31 @@ export function isEdgeGatewayFailureResponse(input: {
477
502
  );
478
503
  }
479
504
 
505
+ const PROVIDER_SERVER_ERROR_RETRY_BASE_MS = 2_000;
506
+ const PROVIDER_SERVER_ERROR_RETRY_MAX_MS = 30_000;
507
+ const PROVIDER_SERVER_ERROR_RETRY_JITTER_RATIO = 0.2;
508
+
509
+ /**
510
+ * Exponential backoff for a provider 5xx (2 s, 4 s, ... capped at 30 s), with
511
+ * ±20% jitter so rows that failed together do not retry together. A longer
512
+ * provider Retry-After wins.
513
+ */
514
+ export function providerServerErrorRetryDelayMs(input: {
515
+ attempt: number;
516
+ retryAfterMs: number;
517
+ random?: () => number;
518
+ }): number {
519
+ const base = Math.min(
520
+ PROVIDER_SERVER_ERROR_RETRY_MAX_MS,
521
+ PROVIDER_SERVER_ERROR_RETRY_BASE_MS * 2 ** Math.max(0, input.attempt - 1),
522
+ );
523
+ const spread =
524
+ 1 +
525
+ ((input.random ?? Math.random)() * 2 - 1) *
526
+ PROVIDER_SERVER_ERROR_RETRY_JITTER_RATIO;
527
+ return Math.max(Math.round(base * spread), input.retryAfterMs);
528
+ }
529
+
480
530
  /** Exponential backoff for edge gateway failures: 1 s, 2 s, 4 s, capped. */
481
531
  function edgeGatewayRetryDelayMs(attempt: number): number {
482
532
  return Math.min(
@@ -513,8 +563,23 @@ export function parseToolExecuteAuthScopeChangedError(input: {
513
563
  return new ToolExecuteAuthScopeChangedError(message);
514
564
  }
515
565
 
566
+ /** A 5xx the provider itself returned, rather than one from Deepline. */
567
+ function isProviderServerErrorResponse(input: {
568
+ status: number;
569
+ bodyText: string;
570
+ }): boolean {
571
+ return (
572
+ input.status >= 500 &&
573
+ input.status < 600 &&
574
+ parseJsonObject(input.bodyText)?.failure_origin === 'provider'
575
+ );
576
+ }
577
+
516
578
  function decideToolExecuteHttpRetry(input: {
517
579
  status: number;
580
+ /** A 5xx the provider itself returned (failure_origin provider). */
581
+ providerServerError?: boolean;
582
+ retryProviderServerErrors?: boolean;
518
583
  idempotencyInProgress?: boolean;
519
584
  gatewayInvocationInProgress?: boolean;
520
585
  customerDbStorageUnavailable?: boolean;
@@ -620,6 +685,19 @@ function decideToolExecuteHttpRetry(input: {
620
685
  reason: 'edge_gateway_transient',
621
686
  };
622
687
  }
688
+ if (
689
+ !input.transientHttpRetrySafe &&
690
+ input.retryProviderServerErrors === true &&
691
+ input.providerServerError === true
692
+ ) {
693
+ // Only successes are final: the same call is sent again with the same
694
+ // provider idempotency key, after a backoff with jitter.
695
+ return {
696
+ retryable: true,
697
+ attemptCap: TOOL_EXECUTE_TRANSIENT_HTTP_MAX_ATTEMPTS,
698
+ reason: 'provider_server_error',
699
+ };
700
+ }
623
701
  if (!input.transientHttpRetrySafe) {
624
702
  return {
625
703
  retryable: false,
@@ -667,6 +745,7 @@ export function createToolExecuteHttpFailureAttemptTracker(): ToolExecuteHttpFai
667
745
  retry_safe_transient_5xx: 0,
668
746
  edge_gateway_transient: 0,
669
747
  unsafe_transient_5xx: 0,
748
+ provider_server_error: 0,
670
749
  hard_billing_error: 0,
671
750
  non_retryable_status: 0,
672
751
  };
@@ -675,6 +754,12 @@ export function createToolExecuteHttpFailureAttemptTracker(): ToolExecuteHttpFai
675
754
  next(input) {
676
755
  const decision = decideToolExecuteHttpRetry({
677
756
  status: input.status,
757
+ providerServerError: isProviderServerErrorResponse({
758
+ status: input.status,
759
+ bodyText: input.bodyText ?? '',
760
+ }),
761
+ retryProviderServerErrors:
762
+ DURABLE_RUNS_ROLLOUT.retryProviderServerErrors,
678
763
  idempotencyInProgress: isIdempotencyInProgressResponse({
679
764
  status: input.status,
680
765
  bodyText: input.bodyText ?? '',
@@ -756,6 +841,8 @@ export function classifyToolExecuteHttpFailure(input: {
756
841
  transientHttpRetrySafe?: boolean;
757
842
  /** The call runs under the gateway's durable execution fence. */
758
843
  executionFenced?: boolean;
844
+ /** Defaults to `DURABLE_RUNS_ROLLOUT.retryProviderServerErrors`. */
845
+ retryProviderServerErrors?: boolean;
759
846
  providerLatencyMs?: number;
760
847
  nowMs?: number;
761
848
  }): ToolExecuteHttpFailureOutcome {
@@ -775,8 +862,14 @@ export function classifyToolExecuteHttpFailure(input: {
775
862
  const edgeGatewayFailure = isEdgeGatewayFailureResponse(input);
776
863
  const executionFenced = input.executionFenced === true;
777
864
  const explicitRetryable = readExplicitToolHttpRetryability(input);
865
+ const providerServerError = isProviderServerErrorResponse(input);
866
+ const retryProviderServerErrors =
867
+ input.retryProviderServerErrors ??
868
+ DURABLE_RUNS_ROLLOUT.retryProviderServerErrors;
778
869
  const initialRetryDecision = decideToolExecuteHttpRetry({
779
870
  status: input.status,
871
+ providerServerError,
872
+ retryProviderServerErrors,
780
873
  idempotencyInProgress,
781
874
  gatewayInvocationInProgress,
782
875
  customerDbStorageUnavailable,
@@ -847,6 +940,8 @@ export function classifyToolExecuteHttpFailure(input: {
847
940
  error.origin === 'provider';
848
941
  const retryDecision = decideToolExecuteHttpRetry({
849
942
  status: input.status,
943
+ providerServerError,
944
+ retryProviderServerErrors,
850
945
  idempotencyInProgress,
851
946
  gatewayInvocationInProgress,
852
947
  customerDbStorageUnavailable,
@@ -879,14 +974,21 @@ export function classifyToolExecuteHttpFailure(input: {
879
974
  typeof flatPublicDetails === 'object' &&
880
975
  (flatPublicDetails as Record<string, unknown>).operationAccepted ===
881
976
  true));
977
+ const olderAttemptStaleAtMs = olderAttemptCallStaleAtMs(input);
978
+ const nowMs = input.nowMs ?? Date.now();
979
+ const waitingOnOlderAttempt =
980
+ olderAttemptStaleAtMs !== null &&
981
+ nowMs < olderAttemptStaleAtMs + OLDER_ATTEMPT_CALL_STALE_GRACE_MS;
882
982
  const shouldRetry =
883
983
  !acceptedOperationNeedsRecovery &&
884
984
  (providerOwnedRateLimit ||
885
985
  attestedProviderDeadline ||
986
+ waitingOnOlderAttempt ||
886
987
  (retryDecision.retryable && input.attempt < retryDecision.attemptCap));
887
988
  // In-attempt retry safety and later-run repairability are different
888
- // decisions. A non-idempotent 5xx must not be repeated automatically inside
889
- // this execution attempt, but an explicit later `plays run` must be able to
989
+ // decisions. Until `retryProviderServerErrors` is on, a non-idempotent 5xx
990
+ // is not repeated inside this execution attempt, but an explicit later
991
+ // `plays run` or `runs resume` must be able to
890
992
  // repair that failed work while completed calls remain reusable. Otherwise
891
993
  // one provider gateway failure poisons the semantic call forever.
892
994
  if (
@@ -895,8 +997,15 @@ export function classifyToolExecuteHttpFailure(input: {
895
997
  ) {
896
998
  error.receiptFailureKind = 'repairable';
897
999
  }
898
- const retryDelayMs =
899
- retryDecision.reason === 'concurrency_backpressure'
1000
+ const retryDelayMs = waitingOnOlderAttempt
1001
+ ? Math.min(
1002
+ OLDER_ATTEMPT_CALL_POLL_MAX_MS,
1003
+ Math.max(
1004
+ TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS,
1005
+ (olderAttemptStaleAtMs ?? nowMs) - nowMs,
1006
+ ),
1007
+ )
1008
+ : retryDecision.reason === 'concurrency_backpressure'
900
1009
  ? Math.min(
901
1010
  TOOL_EXECUTE_CONCURRENCY_BACKPRESSURE_DELAY_MAX_MS,
902
1011
  Math.max(
@@ -931,17 +1040,22 @@ export function classifyToolExecuteHttpFailure(input: {
931
1040
  TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS * input.attempt,
932
1041
  ),
933
1042
  )
934
- : retryDecision.reason === 'edge_gateway_transient'
935
- ? edgeGatewayRetryDelayMs(input.attempt)
936
- : retryDecision.reason === 'idempotency_in_progress' &&
937
- !hasRetryAfterHeader
938
- ? idempotencyInProgressRetryDelayMs(input.attempt)
939
- : retryDecision.reason === 'gateway_invocation_in_progress' &&
1043
+ : retryDecision.reason === 'provider_server_error'
1044
+ ? providerServerErrorRetryDelayMs({
1045
+ attempt: input.attempt,
1046
+ retryAfterMs,
1047
+ })
1048
+ : retryDecision.reason === 'edge_gateway_transient'
1049
+ ? edgeGatewayRetryDelayMs(input.attempt)
1050
+ : retryDecision.reason === 'idempotency_in_progress' &&
940
1051
  !hasRetryAfterHeader
941
1052
  ? idempotencyInProgressRetryDelayMs(input.attempt)
942
- : retryAfterMs > 0
943
- ? Math.min(TOOL_EXECUTE_RETRY_DELAY_MAX_MS, retryAfterMs)
944
- : TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS;
1053
+ : retryDecision.reason === 'gateway_invocation_in_progress' &&
1054
+ !hasRetryAfterHeader
1055
+ ? idempotencyInProgressRetryDelayMs(input.attempt)
1056
+ : retryAfterMs > 0
1057
+ ? Math.min(TOOL_EXECUTE_RETRY_DELAY_MAX_MS, retryAfterMs)
1058
+ : TOOL_EXECUTE_RETRY_DELAY_FALLBACK_MS;
945
1059
  return {
946
1060
  ...retryDecision,
947
1061
  ...(acceptedOperationNeedsRecovery
@@ -981,7 +1095,8 @@ export function classifyToolExecuteHttpFailure(input: {
981
1095
  // keep their identity so a retry recovers the existing reservation.
982
1096
  billingReservationReleased:
983
1097
  shouldRetry &&
984
- retryDecision.reason === 'retry_safe_transient_5xx' &&
1098
+ (retryDecision.reason === 'retry_safe_transient_5xx' ||
1099
+ retryDecision.reason === 'provider_server_error') &&
985
1100
  explicitRetryable === true &&
986
1101
  providerOriginFailure,
987
1102
  // Only explicit pre-dispatch refusals permit automatic replay of an
@@ -115,6 +115,7 @@ export async function mintWorkflowExecutorToken(input: {
115
115
  actorEmail?: string | null;
116
116
  schedulerSchema?: string | null;
117
117
  runAttempt?: number | null;
118
+ resumeEpoch?: number | null;
118
119
  runLeaseToken?: string | null;
119
120
  terminalContract?: DirectCompletedTerminalContract | null;
120
121
  capabilities?: readonly RuntimeExecutionCapability[];
@@ -140,6 +141,7 @@ export async function mintWorkflowExecutorToken(input: {
140
141
  actorEmail: input.actorEmail,
141
142
  schedulerSchema: input.schedulerSchema,
142
143
  runAttempt: input.runAttempt,
144
+ resumeEpoch: input.resumeEpoch,
143
145
  runLeaseToken: input.runLeaseToken,
144
146
  terminalContract: input.terminalContract,
145
147
  capabilities: input.capabilities,
@@ -24,6 +24,8 @@ export const PLAY_AUTHORING_CONTRACT_EDITION = 11 as const;
24
24
  export const PLAY_AUTHORING_SLACK_INTERACTIVE_MESSAGE_STRICT_THRESHOLD =
25
25
  10 as const;
26
26
  export const EXPLICIT_FRESHNESS_PLAY_AUTHORING_THRESHOLD = 11 as const;
27
+ // Edition 12 is reader-only until a later release pins it on new artifacts.
28
+ export const REQUEST_DIGEST_CALL_SLOT_PLAY_AUTHORING_THRESHOLD = 12 as const;
27
29
  const EXPLICIT_FRESHNESS_STALE_AFTER_SECONDS_DESCRIPTION = [
28
30
  'Edition 11 requires an explicit choice.',
29
31
  '`0` starts a fresh logical call, though a matching operation receipt may recover that same operation after resume;',
@@ -33,7 +35,7 @@ const EXPLICIT_FRESHNESS_STALE_AFTER_SECONDS_DESCRIPTION = [
33
35
  ].join(' ');
34
36
  export const PLAY_AUTHORING_INPUT_SCHEMA_SNAPSHOT_EDITION = 3 as const;
35
37
  export const SUPPORTED_PLAY_AUTHORING_CONTRACT_EDITIONS = [
36
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
38
+ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
37
39
  ] as const;
38
40
 
39
41
  export type PlayAuthoringContractEdition =
@@ -119,6 +121,13 @@ const PLAY_AUTHORING_CONTRACT_CHANGELOG_DETAILS = [
119
121
  newWritesEnd: null,
120
122
  readerRemoval: null,
121
123
  },
124
+ {
125
+ changed:
126
+ 'Call slots include a digest of the request, so parallel calls with the same id cannot swap recorded results on a retry or resume. Keeps every edition 11 rule; editions 1–11 retain call-order slots and their completed receipts.',
127
+ compatibilityOwner: 'Plays Runtime',
128
+ newWritesEnd: null,
129
+ readerRemoval: null,
130
+ },
122
131
  ] as const;
123
132
 
124
133
  export function playCsvDatasetRowIdentity(
@@ -14,14 +14,14 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-2JS3H6H6.mjs";
18
- import "./chunk-2MVIS2UI.mjs";
19
- import "./chunk-W5CHE5Q2.mjs";
20
- import "./chunk-3MJSWVQ2.mjs";
17
+ } from "./chunk-HUX5DZO6.mjs";
18
+ import "./chunk-3MLFFWDM.mjs";
19
+ import "./chunk-Y6XKCEPK.mjs";
20
+ import "./chunk-YOQ2NNDO.mjs";
21
21
  import "./chunk-4QF2K7TM.mjs";
22
22
  import "./chunk-DLIRSHV6.mjs";
23
23
  import "./chunk-HBL4PM5Q.mjs";
24
- import "./chunk-OFBLT2LQ.mjs";
24
+ import "./chunk-7F4OEHQK.mjs";
25
25
  import "./chunk-WZYKRD7T.mjs";
26
26
  import "./chunk-KRD6H754.mjs";
27
27
  export {
@@ -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 _chunkFISP4LCKjs = require('./chunk-FISP4LCK.js');
18
+ require('./chunk-QKKU2FH4.js');
19
+ require('./chunk-WBIDPDKJ.js');
20
+ require('./chunk-UJMBG5JU.js');
21
+ require('./chunk-ALJJRZNJ.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-DIAWYWT5.js');
24
+ require('./chunk-6JNBMTCZ.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 = _chunkFISP4LCKjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkFISP4LCKjs.authStatusLine; exports.clearPendingClaim = _chunkFISP4LCKjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkFISP4LCKjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkFISP4LCKjs.handleRegister; exports.handleStatus = _chunkFISP4LCKjs.handleStatus; exports.handleWait = _chunkFISP4LCKjs.handleWait; exports.httpJson = _chunkFISP4LCKjs.httpJson; exports.readPendingAuthClaim = _chunkFISP4LCKjs.readPendingAuthClaim; exports.readStatusBanner = _chunkFISP4LCKjs.readStatusBanner; exports.registerAuthCommands = _chunkFISP4LCKjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunkFISP4LCKjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkFISP4LCKjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkFISP4LCKjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkFISP4LCKjs.statusBannerLine;