deepline 0.3.533 → 0.3.535
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/client-core.ts +68 -7
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/call-requeue-state-machine.ts +420 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +677 -26
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-retry-policy.ts +624 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +32 -14
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +51 -1
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +245 -1
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-no-progress.ts +6 -2
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-tool-hooks.ts +55 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +12 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +2 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +101 -0
- package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +63 -13
- package/dist/cli/auth-VDCU3T6A.js +43 -0
- package/dist/cli/{auth-2TZNPIJQ.mjs → auth-ZCTMB5RA.mjs} +5 -5
- package/dist/cli/{billing-HQYTRIV3.js → billing-GVFKZQH3.js} +82 -82
- package/dist/cli/{billing-LR4WJIHO.mjs → billing-OU2ZHL72.mjs} +7 -7
- package/dist/cli/{chunk-HOTJSXLY.js → chunk-243O3FH5.js} +5 -5
- package/dist/cli/{chunk-TU56J4OV.js → chunk-2D6SWQTK.js} +13 -13
- package/dist/cli/{chunk-4YP2YAIZ.js → chunk-4NLRWKZB.js} +26 -26
- package/dist/cli/{chunk-NW736SOD.mjs → chunk-4QELPWUW.mjs} +2 -2
- package/dist/cli/{chunk-LTF2J3JM.js → chunk-5EKNDNFQ.js} +2 -2
- package/dist/cli/{chunk-VPQDKL5O.js → chunk-6LHX33VN.js} +6 -6
- package/dist/cli/{chunk-LZMRCUVD.mjs → chunk-6TYRRNXY.mjs} +2 -2
- package/dist/cli/{chunk-YZK5RSUL.mjs → chunk-7CWSAEYS.mjs} +1 -1
- package/dist/cli/{chunk-A4JP6RPX.js → chunk-7PXP2FQK.js} +2 -2
- package/dist/cli/{chunk-2TMNRF5R.mjs → chunk-7R5DAANG.mjs} +1 -1
- package/dist/cli/{chunk-NKVW552R.mjs → chunk-AUEUAPVS.mjs} +1 -1
- package/dist/cli/{chunk-3KQBV2CG.mjs → chunk-BF65LB7X.mjs} +3 -3
- package/dist/cli/{chunk-33SNTG5F.js → chunk-CIDATNTY.js} +16 -16
- package/dist/cli/{chunk-O7RSUW75.js → chunk-D4MHCCIR.js} +4 -4
- package/dist/cli/{chunk-5XTXC45Z.js → chunk-DAPKLYST.js} +41 -41
- package/dist/cli/{chunk-USAQ42OG.mjs → chunk-DFJODFMC.mjs} +5 -5
- package/dist/cli/{chunk-KKUOIVQO.mjs → chunk-DWPY6ZID.mjs} +1 -1
- package/dist/cli/{chunk-MNAEALPG.js → chunk-DYIWDUY4.js} +182 -127
- package/dist/cli/{chunk-EVXRQXNV.mjs → chunk-E3CLOVG5.mjs} +47 -0
- package/dist/cli/{chunk-SVVUC3B4.js → chunk-FGN75ZN6.js} +138 -104
- package/dist/cli/{chunk-XZN3DBTP.mjs → chunk-FZKPPB5P.mjs} +40 -6
- package/dist/cli/{chunk-NFDYVMGC.mjs → chunk-G2DLG32W.mjs} +68 -13
- package/dist/cli/{chunk-LZ3PBEQH.mjs → chunk-H6SWS5CG.mjs} +2 -2
- package/dist/cli/{chunk-EYWES7F5.js → chunk-HWPOXCCK.js} +3 -3
- package/dist/cli/{chunk-425ERNBL.js → chunk-HYBZWSSH.js} +44 -44
- package/dist/cli/{chunk-CANHB6DH.mjs → chunk-J75DANZY.mjs} +2 -2
- package/dist/cli/{chunk-CWIGRIIX.mjs → chunk-JQQG4QL4.mjs} +3 -3
- package/dist/cli/{chunk-2UYERVXF.mjs → chunk-JWWYLGUT.mjs} +2 -2
- package/dist/cli/{chunk-735ZOYQN.js → chunk-K3IPGMGP.js} +11 -11
- package/dist/cli/{chunk-VKGNQC2S.mjs → chunk-K53NKWZO.mjs} +5 -5
- package/dist/cli/{chunk-3O3AL5RI.mjs → chunk-K76AEBFY.mjs} +4 -4
- package/dist/cli/{chunk-BWZHMWM5.js → chunk-KA6ZERJL.js} +6 -6
- package/dist/cli/{chunk-4CYNH47Y.js → chunk-KOZBZPRM.js} +53 -53
- package/dist/cli/{chunk-QZWURUBP.js → chunk-KWGXHPHL.js} +7 -7
- package/dist/cli/{chunk-XUX5KGCQ.mjs → chunk-LVISZFYO.mjs} +2 -2
- package/dist/cli/{chunk-B4ZNWXUW.js → chunk-OM732MGV.js} +9 -9
- package/dist/cli/{chunk-352XVCGE.js → chunk-PHLNYBAA.js} +5 -5
- package/dist/cli/{chunk-ZH5HCAN3.js → chunk-PI5R65OQ.js} +1 -1
- package/dist/cli/{chunk-JZ7LJS3P.mjs → chunk-QYBAHYP4.mjs} +6 -6
- package/dist/cli/{chunk-G3GJ3IGU.mjs → chunk-R2KKEHJN.mjs} +5 -5
- package/dist/cli/{chunk-R7YDZSN7.js → chunk-RFQWSH6I.js} +3 -3
- package/dist/cli/{chunk-MKUYZ7LR.mjs → chunk-RKY4LBX3.mjs} +1 -1
- package/dist/cli/{chunk-WF652G74.js → chunk-T7RBM2WX.js} +14 -14
- package/dist/cli/{chunk-G3RVDRYL.mjs → chunk-TCVCFZP6.mjs} +1 -1
- package/dist/cli/{chunk-E4VWBU2E.js → chunk-UUQ2OXMH.js} +16 -16
- package/dist/cli/{chunk-IETLUG4C.mjs → chunk-W5YJYU4G.mjs} +1 -1
- package/dist/cli/{chunk-HPOVAUQF.mjs → chunk-W6T23EUC.mjs} +1 -1
- package/dist/cli/{chunk-BSI7UHQZ.mjs → chunk-WAIBM6KX.mjs} +5 -5
- package/dist/cli/{chunk-4UADZTU5.js → chunk-WNNA4L6Z.js} +22 -22
- package/dist/cli/{chunk-V6LUMGVI.js → chunk-XSOTEVOB.js} +47 -0
- package/dist/cli/{chunk-PIACHLYY.mjs → chunk-YFZLZNTH.mjs} +2 -2
- package/dist/cli/{chunk-274Y66HP.js → chunk-ZUVE63Y7.js} +2 -2
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-MBSCHS4H.js → csv-CD55KEIO.js} +13 -13
- package/dist/cli/{csv-CJKKHGNQ.mjs → csv-CLPVMIRF.mjs} +4 -4
- package/dist/cli/{db-EAFR6N45.mjs → db-AU4SMWUN.mjs} +6 -6
- package/dist/cli/{db-45HNPCY3.js → db-MQKLDAEO.js} +27 -27
- package/dist/cli/describe-5BFNHT5V.js +50 -0
- package/dist/cli/{describe-IXW3LDGC.mjs → describe-AWJUXE2U.mjs} +18 -18
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/{executions-SZAES2S4.js → executions-77GOLWRM.js} +8 -8
- package/dist/cli/{executions-ZATZV7O6.mjs → executions-TFIJPUX7.mjs} +6 -6
- package/dist/cli/{feedback-NY63KEK2.mjs → feedback-2WRSZ5WL.mjs} +6 -6
- package/dist/cli/{feedback-KXLF4GR4.js → feedback-OV5YAL3A.js} +14 -14
- package/dist/cli/git-HGMX52XU.js +25 -0
- package/dist/cli/{git-BSSSTR6N.mjs → git-VNS4ATLZ.mjs} +5 -5
- package/dist/cli/index.js +145 -145
- package/dist/cli/index.mjs +44 -44
- package/dist/cli/{legacy-noops-CYF6DJBF.mjs → legacy-noops-C732QDCY.mjs} +6 -6
- package/dist/cli/{legacy-noops-XQANGML3.js → legacy-noops-HDOB5C6F.js} +9 -9
- package/dist/cli/{monitors-ABJVLWIP.mjs → monitors-2LYEFXOU.mjs} +7 -7
- package/dist/cli/{monitors-F3PTNP45.js → monitors-5IUMHH3E.js} +100 -100
- package/dist/cli/{org-WQAPZI5Q.js → org-ADW2EVAC.js} +86 -86
- package/dist/cli/{org-BHF6Y5R7.mjs → org-G4YGZPHS.mjs} +6 -6
- package/dist/cli/{pages-W4HWVJUG.mjs → pages-KXKWSCEV.mjs} +6 -6
- package/dist/cli/{pages-U3EJ2NPL.js → pages-VTJGAI2D.js} +18 -18
- package/dist/cli/{play-3T4X3ZKH.mjs → play-7GQ56C2D.mjs} +69 -22
- package/dist/cli/{play-2UHKONON.js → play-EHSOSSHT.js} +367 -320
- package/dist/cli/{providers-LUK5LIUA.js → providers-PWCF6OOO.js} +9 -9
- package/dist/cli/{providers-2G2VTNDG.mjs → providers-WL3YTCSV.mjs} +6 -6
- package/dist/cli/{quickstart-XP4PJZ7N.mjs → quickstart-323XOPGI.mjs} +4 -4
- package/dist/cli/{quickstart-76P6PGID.js → quickstart-ZKI5MURA.js} +6 -6
- package/dist/cli/{run-S2KHGBCM.js → run-XZPWA6JS.js} +41 -41
- package/dist/cli/{run-ACIHA53A.mjs → run-ZCNZU3K2.mjs} +23 -23
- package/dist/cli/{search-VFIJCUZL.mjs → search-CVLVSFMJ.mjs} +8 -8
- package/dist/cli/search-J6EY7DQN.js +33 -0
- package/dist/cli/{search-output-2KFLZS5F.mjs → search-output-6PY6RN2R.mjs} +4 -4
- package/dist/cli/{search-output-GV7NNB4X.js → search-output-7HRSSRBS.js} +6 -6
- package/dist/cli/{secrets-MAQLBVC4.mjs → secrets-6S2ZWDIM.mjs} +6 -6
- package/dist/cli/{secrets-KJSFEW2F.js → secrets-IYD5VKY4.js} +15 -15
- package/dist/cli/sessions-7HPIVSQ4.js +22 -0
- package/dist/cli/{sessions-G5MWNJ75.mjs → sessions-GVEX5TUJ.mjs} +6 -6
- package/dist/cli/{settings-MR6UFOK5.mjs → settings-BN5MJZ3C.mjs} +13 -13
- package/dist/cli/{settings-VXGRPFXP.js → settings-CANK4HJQ.js} +86 -86
- package/dist/cli/{setup-ZOBXMONM.mjs → setup-JNMSCCU4.mjs} +10 -10
- package/dist/cli/{setup-C74BRK7N.js → setup-YSGKGLSJ.js} +50 -50
- package/dist/cli/{skills-4CG3MHOY.mjs → skills-QCQN2UM2.mjs} +8 -8
- package/dist/cli/skills-WDGSSKJZ.js +37 -0
- package/dist/cli/{tools-YXCXZ4ZD.mjs → tools-CDPOID7V.mjs} +17 -17
- package/dist/cli/tools-URNVXSTZ.js +57 -0
- package/dist/cli/{update-Z3C5W3I4.mjs → update-D3ZERUQ3.mjs} +10 -10
- package/dist/cli/update-Q6JW32IA.js +35 -0
- package/dist/cli/{views-XGP2GZ52.js → views-4NV2KQKA.js} +18 -18
- package/dist/cli/{views-45B2FZQT.mjs → views-RDZRWQBQ.mjs} +6 -6
- package/dist/cli/{workflow-KQRWSNBH.mjs → workflow-2CG3TVCG.mjs} +7 -7
- package/dist/cli/{workflow-DWO35XHZ.js → workflow-RABJCAZC.js} +17 -17
- package/dist/{client-Bd2meveV.d.mts → client-DhSvMO3A.d.mts} +1 -1
- package/dist/{client-core-CGj8V9mw.d.mts → client-core-CVG1Et-4.d.mts} +41 -2
- package/dist/{client-core-CsRRWCFy.d.ts → client-core-CdWH6Sii.d.ts} +41 -2
- package/dist/{client-CBCVhL8U.d.ts → client-oGNJMQFd.d.ts} +1 -1
- package/dist/{compiler-manifest-DsxsQP-T.d.ts → compiler-manifest-D2ZlBGxj.d.mts} +44 -0
- package/dist/{compiler-manifest-DsxsQP-T.d.mts → compiler-manifest-D2ZlBGxj.d.ts} +44 -0
- package/dist/{errors-qdJUVQ3g.d.mts → errors-B-gOQdj-.d.mts} +1 -1
- package/dist/{errors-Bk5h1D-C.d.ts → errors-CB0KAmmV.d.ts} +1 -1
- package/dist/{index-PaupwX1B.d.mts → index-BbJADro4.d.mts} +1 -1
- package/dist/{index-bL66eHYz.d.ts → index-c3nvUGCS.d.ts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +118 -116
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/bundle-play-file.mjs +52 -0
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-KE6RFHUE.js +0 -43
- package/dist/cli/describe-PYLZAVRI.js +0 -50
- package/dist/cli/git-T5JTVBYZ.js +0 -25
- package/dist/cli/search-5MD65V43.js +0 -33
- package/dist/cli/sessions-FDMO7PAA.js +0 -22
- package/dist/cli/skills-KRUL7QCT.js +0 -37
- package/dist/cli/tools-CGHOSCPS.js +0 -57
- package/dist/cli/update-S2TILEHZ.js +0 -35
|
@@ -320,7 +320,9 @@ import {
|
|
|
320
320
|
normalizePlayAuthoringCustomerDbStatement,
|
|
321
321
|
validateOptionalPlayAuthoringField,
|
|
322
322
|
validatePlayAuthoringField,
|
|
323
|
+
validatePlayToolCallRetryPolicy,
|
|
323
324
|
type PlayAuthoringContractEdition,
|
|
325
|
+
type PlayToolCallRetryPolicy,
|
|
324
326
|
type PlaySecretAuth,
|
|
325
327
|
type PlaySecretAwareRequestInit,
|
|
326
328
|
type PlaySecretPromise,
|
|
@@ -474,6 +476,16 @@ import {
|
|
|
474
476
|
isPlayRowExecutionSuspendedError,
|
|
475
477
|
type PlayExecutionSuspension,
|
|
476
478
|
} from './suspension';
|
|
479
|
+
import type { DurableRetryErrorClass } from './durable-retry-policy';
|
|
480
|
+
import {
|
|
481
|
+
BILLING_ERROR_CLASSES,
|
|
482
|
+
callRequeueSends,
|
|
483
|
+
classifyDurableRetryErrorClass,
|
|
484
|
+
decideCallRequeue,
|
|
485
|
+
genericHttpWriteIdempotency,
|
|
486
|
+
transitionCallRequeue,
|
|
487
|
+
type CallRequeueRecord,
|
|
488
|
+
} from './call-requeue-state-machine';
|
|
477
489
|
import {
|
|
478
490
|
createRequestHeaderSecretRedactionContext,
|
|
479
491
|
createSecretRedactionContext,
|
|
@@ -2153,7 +2165,112 @@ function settleToolBatchGroups(
|
|
|
2153
2165
|
);
|
|
2154
2166
|
}
|
|
2155
2167
|
|
|
2168
|
+
/**
|
|
2169
|
+
* The Durable retry class of one in-call HTTP failure, from structured fields
|
|
2170
|
+
* only (the outcome, its ToolExecutionError, and the failure body's `code`,
|
|
2171
|
+
* `upstream_status`, `error_category` and `network_kind`). null: the failure never retries
|
|
2172
|
+
* durably.
|
|
2173
|
+
*/
|
|
2174
|
+
function durableRetryErrorClassForHttpFailure(input: {
|
|
2175
|
+
status: number;
|
|
2176
|
+
failure: ToolExecuteHttpFailureOutcome;
|
|
2177
|
+
responseText: string;
|
|
2178
|
+
}): DurableRetryErrorClass | null {
|
|
2179
|
+
let bodyCode: string | null = null;
|
|
2180
|
+
let bodyUpstreamStatus: number | null = null;
|
|
2181
|
+
let bodyCategory: string | null = null;
|
|
2182
|
+
let bodyNetworkKind: string | null = null;
|
|
2183
|
+
try {
|
|
2184
|
+
const body = JSON.parse(input.responseText) as unknown;
|
|
2185
|
+
if (body && typeof body === 'object' && !Array.isArray(body)) {
|
|
2186
|
+
const fields = body as Record<string, unknown>;
|
|
2187
|
+
bodyCode = typeof fields.code === 'string' ? fields.code : null;
|
|
2188
|
+
bodyUpstreamStatus =
|
|
2189
|
+
typeof fields.upstream_status === 'number'
|
|
2190
|
+
? fields.upstream_status
|
|
2191
|
+
: null;
|
|
2192
|
+
bodyCategory =
|
|
2193
|
+
typeof fields.error_category === 'string'
|
|
2194
|
+
? fields.error_category
|
|
2195
|
+
: null;
|
|
2196
|
+
bodyNetworkKind =
|
|
2197
|
+
typeof fields.network_kind === 'string' ? fields.network_kind : null;
|
|
2198
|
+
}
|
|
2199
|
+
} catch {
|
|
2200
|
+
bodyCode = null;
|
|
2201
|
+
}
|
|
2202
|
+
const { failure } = input;
|
|
2203
|
+
return classifyDurableRetryErrorClass({
|
|
2204
|
+
status: input.status,
|
|
2205
|
+
reason: failure.reason,
|
|
2206
|
+
knownNotDispatched: failure.knownNotDispatched,
|
|
2207
|
+
origin:
|
|
2208
|
+
failure.error instanceof ToolExecutionError ? failure.error.origin : null,
|
|
2209
|
+
code:
|
|
2210
|
+
failure.error instanceof ToolExecutionError && failure.error.code
|
|
2211
|
+
? failure.error.code
|
|
2212
|
+
: bodyCode,
|
|
2213
|
+
upstreamStatus: bodyUpstreamStatus,
|
|
2214
|
+
category: bodyCategory,
|
|
2215
|
+
networkKind: bodyNetworkKind,
|
|
2216
|
+
});
|
|
2217
|
+
}
|
|
2218
|
+
|
|
2219
|
+
/**
|
|
2220
|
+
* Whether a call retries durably. Only a call that sets its own `retry` does
|
|
2221
|
+
* for now; a call without one keeps the behaviour from before durable
|
|
2222
|
+
* retries (in-call retries, then the error reaches the Play).
|
|
2223
|
+
*
|
|
2224
|
+
* Temporary ordering, not a switch: prebuilt Plays typecheck against the SDK
|
|
2225
|
+
* Production runs, which gains `retry` only when this ships, so they cannot
|
|
2226
|
+
* bound their fallback legs yet. PR #10348 removes this predicate together
|
|
2227
|
+
* with the prebuilt `retry` legs, making durable retry every call's
|
|
2228
|
+
* behaviour.
|
|
2229
|
+
*/
|
|
2230
|
+
export function callOptsIntoDurableRetry(
|
|
2231
|
+
retry: PlayToolCallRetryPolicy | undefined,
|
|
2232
|
+
): boolean {
|
|
2233
|
+
return retry !== undefined;
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
/**
|
|
2237
|
+
* A call's own `retry` governs its in-call resends too, like an activity
|
|
2238
|
+
* RetryPolicy counts every attempt. A class it lists as `nonRetryable`, or
|
|
2239
|
+
* `maximumAttempts: 1` for a request the provider received, is not resent and
|
|
2240
|
+
* not paced inside the call: the error reaches the Play after this attempt.
|
|
2241
|
+
* Deepline's own pre-dispatch refusals are not attempts and keep pacing.
|
|
2242
|
+
*/
|
|
2243
|
+
export function callRetryStopsInCallRetry(input: {
|
|
2244
|
+
callRetry: PlayToolCallRetryPolicy | undefined;
|
|
2245
|
+
errorClass: DurableRetryErrorClass | null;
|
|
2246
|
+
preDispatchRefusal: boolean;
|
|
2247
|
+
/**
|
|
2248
|
+
* Requests the provider received for this call so far, this one included:
|
|
2249
|
+
* earlier bursts (the requeue record) plus this burst.
|
|
2250
|
+
*/
|
|
2251
|
+
sends: number;
|
|
2252
|
+
}): boolean {
|
|
2253
|
+
const { callRetry, errorClass } = input;
|
|
2254
|
+
if (!callRetry) return false;
|
|
2255
|
+
if (errorClass !== null && callRetry.nonRetryable?.includes(errorClass)) {
|
|
2256
|
+
return true;
|
|
2257
|
+
}
|
|
2258
|
+
// Like an activity retry policy, the limit bounds every attempt, whatever
|
|
2259
|
+
// the failure's class.
|
|
2260
|
+
return (
|
|
2261
|
+
callRetry.maximumAttempts !== undefined &&
|
|
2262
|
+
!input.preDispatchRefusal &&
|
|
2263
|
+
input.sends >= callRetry.maximumAttempts
|
|
2264
|
+
);
|
|
2265
|
+
}
|
|
2266
|
+
|
|
2156
2267
|
type ToolExecutionApiOptions = {
|
|
2268
|
+
/**
|
|
2269
|
+
* The call's own retry policy (`ctx.tools.execute({ retry })`). It governs
|
|
2270
|
+
* the in-call resends and the durable retries; a call that sets it never
|
|
2271
|
+
* joins a native provider batch.
|
|
2272
|
+
*/
|
|
2273
|
+
retry?: PlayToolCallRetryPolicy;
|
|
2157
2274
|
/**
|
|
2158
2275
|
* The call's replay-stable identity in the run, for an async provider wait
|
|
2159
2276
|
* that has no other durable identity. A retried attempt sends the same
|
|
@@ -3350,6 +3467,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
3350
3467
|
staleAfterSeconds?: number | null;
|
|
3351
3468
|
timeoutMs?: number;
|
|
3352
3469
|
receiptWaitMs?: number;
|
|
3470
|
+
retry?: PlayToolCallRetryPolicy;
|
|
3353
3471
|
}): Promise<TOutput> => {
|
|
3354
3472
|
this.assertNoPendingDurableSuspension();
|
|
3355
3473
|
if (!request || typeof request !== 'object' || Array.isArray(request)) {
|
|
@@ -3388,6 +3506,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
3388
3506
|
request.receiptWaitMs,
|
|
3389
3507
|
);
|
|
3390
3508
|
}
|
|
3509
|
+
// The call's own retry policy replaces the class rule where it sets a
|
|
3510
|
+
// field; without it, the live Durable retry policy decides.
|
|
3511
|
+
const retry = request.retry;
|
|
3512
|
+
if (retry !== undefined) validatePlayToolCallRetryPolicy(retry);
|
|
3391
3513
|
const force =
|
|
3392
3514
|
request.force === true ||
|
|
3393
3515
|
toolExecutionOverrides.getStore()?.force === true;
|
|
@@ -3399,7 +3521,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
3399
3521
|
force ||
|
|
3400
3522
|
request.staleAfterSeconds !== undefined ||
|
|
3401
3523
|
request.timeoutMs !== undefined ||
|
|
3402
|
-
request.receiptWaitMs !== undefined
|
|
3524
|
+
request.receiptWaitMs !== undefined ||
|
|
3525
|
+
retry !== undefined
|
|
3403
3526
|
? {
|
|
3404
3527
|
...(request.description
|
|
3405
3528
|
? { description: request.description }
|
|
@@ -3414,6 +3537,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
3414
3537
|
...(request.receiptWaitMs !== undefined
|
|
3415
3538
|
? { receiptWaitMs: request.receiptWaitMs }
|
|
3416
3539
|
: {}),
|
|
3540
|
+
...(retry !== undefined ? { retry } : {}),
|
|
3417
3541
|
}
|
|
3418
3542
|
: undefined,
|
|
3419
3543
|
).catch((error: unknown) => {
|
|
@@ -12289,6 +12413,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
12289
12413
|
? { heapProbe: this.#options.runtimeMapHeapProbe }
|
|
12290
12414
|
: {}),
|
|
12291
12415
|
getEventLoopLagMs: () => this.resourceGovernor.eventLoopLagEwmaMs(),
|
|
12416
|
+
callSlotBacklog: () =>
|
|
12417
|
+
this.resourceGovernor.externalExecutionBacklog?.() ?? null,
|
|
12292
12418
|
onMemoryPressure: releaseCommittedRowsForMemoryPressure,
|
|
12293
12419
|
// Provider bodies enter through `providerResponseBodyGate` below, which
|
|
12294
12420
|
// reserves them at materialization and holds the measurement through the
|
|
@@ -13932,14 +14058,24 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
13932
14058
|
}
|
|
13933
14059
|
}
|
|
13934
14060
|
|
|
14061
|
+
/**
|
|
14062
|
+
* A call that sets its own `retry` never joins a native provider batch: it
|
|
14063
|
+
* runs as its own request so its retry policy, not the batch's, applies.
|
|
14064
|
+
*/
|
|
14065
|
+
private batchOperationStrategyFor(
|
|
14066
|
+
request: Pick<ToolCallRequest, 'toolId' | 'retry'>,
|
|
14067
|
+
): AnyBatchOperationStrategy | null {
|
|
14068
|
+
if (request.retry !== undefined) return null;
|
|
14069
|
+
return this.#options.getBatchOperationStrategy?.(request.toolId) ?? null;
|
|
14070
|
+
}
|
|
14071
|
+
|
|
13935
14072
|
private toolDispatchLane(request: ToolCallRequest): {
|
|
13936
14073
|
key: string;
|
|
13937
14074
|
readyCount: number;
|
|
13938
14075
|
maxGroupSize: number;
|
|
13939
14076
|
coalesceWindowMs: number;
|
|
13940
14077
|
} {
|
|
13941
|
-
const strategy =
|
|
13942
|
-
this.#options.getBatchOperationStrategy?.(request.toolId) ?? null;
|
|
14078
|
+
const strategy = this.batchOperationStrategyFor(request);
|
|
13943
14079
|
if (strategy) {
|
|
13944
14080
|
return {
|
|
13945
14081
|
key: [
|
|
@@ -14188,8 +14324,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14188
14324
|
this.mappedResolverHostTurn &&
|
|
14189
14325
|
requests.some(
|
|
14190
14326
|
(request) =>
|
|
14191
|
-
(this
|
|
14192
|
-
?.maxBatchSize ?? 1) > 1,
|
|
14327
|
+
(this.batchOperationStrategyFor(request)?.maxBatchSize ?? 1) > 1,
|
|
14193
14328
|
)
|
|
14194
14329
|
) {
|
|
14195
14330
|
return {
|
|
@@ -14427,9 +14562,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14427
14562
|
const admissionObserver: ToolBatchAdmissionObserver = {
|
|
14428
14563
|
pending: (requests) => {
|
|
14429
14564
|
for (const request of requests) {
|
|
14430
|
-
const strategy = this
|
|
14431
|
-
request.toolId,
|
|
14432
|
-
);
|
|
14565
|
+
const strategy = this.batchOperationStrategyFor(request);
|
|
14433
14566
|
// A scalar-only strategy has no arrivals to aggregate. Holding its
|
|
14434
14567
|
// lane would serialize receipt I/O before provider admission.
|
|
14435
14568
|
if (!strategy || strategy.maxBatchSize <= 1) continue;
|
|
@@ -14939,6 +15072,22 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
14939
15072
|
input: Record<string, unknown>,
|
|
14940
15073
|
options?: ToolCallOptions,
|
|
14941
15074
|
): Promise<unknown> {
|
|
15075
|
+
if (
|
|
15076
|
+
toolId.trim() === 'google_calendar_availability_get_free_busy' &&
|
|
15077
|
+
this.activeInlineComposition
|
|
15078
|
+
) {
|
|
15079
|
+
throw new Error(
|
|
15080
|
+
'Google Calendar Availability must be called directly by the approved published Play.',
|
|
15081
|
+
);
|
|
15082
|
+
}
|
|
15083
|
+
if (
|
|
15084
|
+
this.activeInlineComposition &&
|
|
15085
|
+
toolId.trim().startsWith('google_calendar_availability_')
|
|
15086
|
+
) {
|
|
15087
|
+
throw new Error(
|
|
15088
|
+
'Call the Google Calendar booking tool directly in the admitted Play.',
|
|
15089
|
+
);
|
|
15090
|
+
}
|
|
14942
15091
|
if (!this.usesExplicitFreshness) {
|
|
14943
15092
|
return this.executeToolLegacyInternal(key, toolId, input, options);
|
|
14944
15093
|
}
|
|
@@ -15198,7 +15347,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
15198
15347
|
completedAt: Date.now(),
|
|
15199
15348
|
unavailableReason: liveDataset
|
|
15200
15349
|
? 'Dataset rows are live observations; the dataset owner controls pagination and recovery.'
|
|
15201
|
-
:
|
|
15350
|
+
: toolId === 'google_calendar_availability_get_free_busy'
|
|
15351
|
+
? 'Team availability and its approval are checked on every invocation.'
|
|
15352
|
+
: 'Workspace reviewer edits and conflict checks must be observed on every invocation.',
|
|
15202
15353
|
};
|
|
15203
15354
|
return isToolExecuteResult(value)
|
|
15204
15355
|
? cloneToolExecuteResultWithExecution(value, {
|
|
@@ -15912,6 +16063,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
15912
16063
|
startedAt: directCallStartedAt,
|
|
15913
16064
|
input,
|
|
15914
16065
|
options: {
|
|
16066
|
+
...(options?.retry ? { retry: options.retry } : {}),
|
|
15915
16067
|
...(useDirectResultReceipts
|
|
15916
16068
|
? {
|
|
15917
16069
|
durableCallReceiptKey: physicalDirectKey,
|
|
@@ -16262,6 +16414,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
16262
16414
|
...(options?.receiptWaitMs !== undefined
|
|
16263
16415
|
? { receiptWaitMs: options.receiptWaitMs }
|
|
16264
16416
|
: {}),
|
|
16417
|
+
...(options?.retry ? { retry: options.retry } : {}),
|
|
16265
16418
|
tableNamespace: store.tableNamespace,
|
|
16266
16419
|
rowKey: store.rowKey ?? null,
|
|
16267
16420
|
description: normalizeStepDescription(options?.description),
|
|
@@ -17355,6 +17508,238 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
17355
17508
|
});
|
|
17356
17509
|
}
|
|
17357
17510
|
|
|
17511
|
+
/**
|
|
17512
|
+
* A call's in-call retries are spent. Park it per the Durable retry policy
|
|
17513
|
+
* snapshot this attempt read (a mapped row waits on its own; a call outside
|
|
17514
|
+
* a map suspends the run on a durable sleep), or return so the caller
|
|
17515
|
+
* throws the original error into the Play. Never returns after a park.
|
|
17516
|
+
*/
|
|
17517
|
+
/** Durable retry policy snapshots whose warnings this attempt already logged. */
|
|
17518
|
+
private readonly loggedDurableRetryPolicyWarnings = new Set<string>();
|
|
17519
|
+
|
|
17520
|
+
private async parkExhaustedCallOrFail(input: {
|
|
17521
|
+
toolId: string;
|
|
17522
|
+
provider: string;
|
|
17523
|
+
callRequeueKey: string;
|
|
17524
|
+
status: number;
|
|
17525
|
+
/**
|
|
17526
|
+
* The failure to classify, or the class it already has (a provider hold
|
|
17527
|
+
* whose no-progress limit is spent is `rate_limit_429`).
|
|
17528
|
+
*/
|
|
17529
|
+
failure:
|
|
17530
|
+
| ToolExecuteHttpFailureOutcome
|
|
17531
|
+
| { errorClass: DurableRetryErrorClass };
|
|
17532
|
+
responseText: string;
|
|
17533
|
+
providerServerErrorReplay: 'idempotent_key' | 'read_safe' | 'never';
|
|
17534
|
+
rowScoped: boolean;
|
|
17535
|
+
/** The call's input, for a per-request write class (generic HTTP). */
|
|
17536
|
+
toolInput: Record<string, unknown>;
|
|
17537
|
+
/** The invocation attempt that just failed. */
|
|
17538
|
+
invocationAttempt: number;
|
|
17539
|
+
/** The call runs under the gateway's durable execution fence. */
|
|
17540
|
+
fenced: boolean;
|
|
17541
|
+
/** The call's own retry policy (`ctx.tools.execute({ retry })`). */
|
|
17542
|
+
callRetry?: PlayToolCallRetryPolicy;
|
|
17543
|
+
/** Requests the provider received in the burst that just failed. */
|
|
17544
|
+
sendsThisBurst: number;
|
|
17545
|
+
writeRecord: (record: CallRequeueRecord | null) => void;
|
|
17546
|
+
}): Promise<void> {
|
|
17547
|
+
const { failure } = input;
|
|
17548
|
+
const prior = this.checkpoint.callRequeueStates?.[input.callRequeueKey];
|
|
17549
|
+
// Every way out without a park ends a resumed call's record, so a later
|
|
17550
|
+
// failure of the same key never inherits stale counts.
|
|
17551
|
+
const exhaustPrior = () => {
|
|
17552
|
+
if (prior?.state === 'in_call') {
|
|
17553
|
+
input.writeRecord(transitionCallRequeue(prior, 'exhaust', Date.now()));
|
|
17554
|
+
}
|
|
17555
|
+
};
|
|
17556
|
+
const errorClass =
|
|
17557
|
+
'errorClass' in failure
|
|
17558
|
+
? failure.errorClass
|
|
17559
|
+
: durableRetryErrorClassForHttpFailure({
|
|
17560
|
+
status: input.status,
|
|
17561
|
+
failure,
|
|
17562
|
+
responseText: input.responseText,
|
|
17563
|
+
});
|
|
17564
|
+
if (!errorClass) {
|
|
17565
|
+
exhaustPrior();
|
|
17566
|
+
return;
|
|
17567
|
+
}
|
|
17568
|
+
// A billing refusal inside a map keeps its run-fatal behaviour: parking
|
|
17569
|
+
// each row would hold one record and one billing retry per row. A billing
|
|
17570
|
+
// hold outside a map parks the run once.
|
|
17571
|
+
if (input.rowScoped && BILLING_ERROR_CLASSES.has(errorClass)) {
|
|
17572
|
+
exhaustPrior();
|
|
17573
|
+
return;
|
|
17574
|
+
}
|
|
17575
|
+
// A fenced call's billing refusal is a recorded non-retryable outcome the
|
|
17576
|
+
// gateway would refuse to follow after the wait: keep it run-fatal.
|
|
17577
|
+
if (input.fenced && BILLING_ERROR_CLASSES.has(errorClass)) {
|
|
17578
|
+
exhaustPrior();
|
|
17579
|
+
return;
|
|
17580
|
+
}
|
|
17581
|
+
let retryContext: NonNullable<
|
|
17582
|
+
Awaited<
|
|
17583
|
+
ReturnType<NonNullable<ContextOptions['getToolDurableRetryContext']>>
|
|
17584
|
+
>
|
|
17585
|
+
>;
|
|
17586
|
+
try {
|
|
17587
|
+
const resolved = await this.#options.getToolDurableRetryContext!(
|
|
17588
|
+
input.toolId,
|
|
17589
|
+
);
|
|
17590
|
+
if (!resolved) {
|
|
17591
|
+
exhaustPrior();
|
|
17592
|
+
return;
|
|
17593
|
+
}
|
|
17594
|
+
retryContext = resolved;
|
|
17595
|
+
} catch (contextError) {
|
|
17596
|
+
this.runtimeLog(
|
|
17597
|
+
`[runtime.call_requeue.unavailable] ${JSON.stringify({
|
|
17598
|
+
tool_id: input.toolId,
|
|
17599
|
+
error_class: errorClass,
|
|
17600
|
+
error:
|
|
17601
|
+
contextError instanceof Error
|
|
17602
|
+
? contextError.message
|
|
17603
|
+
: String(contextError),
|
|
17604
|
+
})}`,
|
|
17605
|
+
{ level: 'error' },
|
|
17606
|
+
);
|
|
17607
|
+
exhaustPrior();
|
|
17608
|
+
return;
|
|
17609
|
+
}
|
|
17610
|
+
const policyLogKey = `${retryContext.policy.source}:${retryContext.policy.sequence}`;
|
|
17611
|
+
if (
|
|
17612
|
+
retryContext.policy.warnings.length > 0 &&
|
|
17613
|
+
!this.loggedDurableRetryPolicyWarnings.has(policyLogKey)
|
|
17614
|
+
) {
|
|
17615
|
+
// Once per attempt per policy snapshot, not per exhausted call.
|
|
17616
|
+
this.loggedDurableRetryPolicyWarnings.add(policyLogKey);
|
|
17617
|
+
this.runtimeLog(
|
|
17618
|
+
`[runtime.call_requeue.policy] ${JSON.stringify({
|
|
17619
|
+
source: retryContext.policy.source,
|
|
17620
|
+
policy_sequence: retryContext.policy.sequence,
|
|
17621
|
+
warnings: retryContext.policy.warnings,
|
|
17622
|
+
})}`,
|
|
17623
|
+
{
|
|
17624
|
+
level:
|
|
17625
|
+
retryContext.policy.source === 'compiled_default'
|
|
17626
|
+
? 'error'
|
|
17627
|
+
: 'warn',
|
|
17628
|
+
},
|
|
17629
|
+
);
|
|
17630
|
+
}
|
|
17631
|
+
const nowMs = Date.now();
|
|
17632
|
+
const decision = decideCallRequeue({
|
|
17633
|
+
record: prior,
|
|
17634
|
+
errorClass,
|
|
17635
|
+
snapshot: retryContext.policy,
|
|
17636
|
+
failedInvocationAttempt: input.invocationAttempt,
|
|
17637
|
+
fenced: input.fenced,
|
|
17638
|
+
effect: retryContext.effect,
|
|
17639
|
+
writeIdempotency:
|
|
17640
|
+
input.toolId === 'generic_http_request'
|
|
17641
|
+
? genericHttpWriteIdempotency(input.toolInput.method)
|
|
17642
|
+
: retryContext.writeIdempotency,
|
|
17643
|
+
idempotencyKeyHonored:
|
|
17644
|
+
input.providerServerErrorReplay === 'idempotent_key',
|
|
17645
|
+
...(input.callRetry ? { callRetry: input.callRetry } : {}),
|
|
17646
|
+
sends: callRequeueSends(prior) + input.sendsThisBurst,
|
|
17647
|
+
nowMs,
|
|
17648
|
+
});
|
|
17649
|
+
if (decision.kind === 'exhaust') {
|
|
17650
|
+
// Only a call this attempt is retrying can end here; a record parked by
|
|
17651
|
+
// a concurrent same-key call is left to that call.
|
|
17652
|
+
exhaustPrior();
|
|
17653
|
+
this.runtimeLog(
|
|
17654
|
+
`[runtime.call_requeue.exhausted] ${JSON.stringify({
|
|
17655
|
+
tool_id: input.toolId,
|
|
17656
|
+
error_class: errorClass,
|
|
17657
|
+
reason: decision.reason,
|
|
17658
|
+
parks: prior?.parks ?? 0,
|
|
17659
|
+
policy_sequence: retryContext.policy.sequence,
|
|
17660
|
+
})}`,
|
|
17661
|
+
{ level: 'warn' },
|
|
17662
|
+
);
|
|
17663
|
+
return;
|
|
17664
|
+
}
|
|
17665
|
+
input.writeRecord(decision.record);
|
|
17666
|
+
const cause = BILLING_ERROR_CLASSES.has(errorClass)
|
|
17667
|
+
? 'waiting for billing'
|
|
17668
|
+
: errorClass === 'rate_limit_429'
|
|
17669
|
+
? `rate limited by ${input.provider}`
|
|
17670
|
+
: `${input.provider} unavailable`;
|
|
17671
|
+
this.runtimeLog(
|
|
17672
|
+
`[runtime.call_requeue.parked] ${cause}, retrying at ${new Date(decision.retryAtMs).toISOString()} ${JSON.stringify(
|
|
17673
|
+
{
|
|
17674
|
+
tool_id: input.toolId,
|
|
17675
|
+
error_class: errorClass,
|
|
17676
|
+
transition: decision.transition,
|
|
17677
|
+
parks: decision.record.parks,
|
|
17678
|
+
consecutive: decision.record.consecutive,
|
|
17679
|
+
wait_ms: decision.waitMs,
|
|
17680
|
+
policy_sequence: retryContext.policy.sequence,
|
|
17681
|
+
policy_source: retryContext.policy.source,
|
|
17682
|
+
},
|
|
17683
|
+
)}`,
|
|
17684
|
+
{ level: 'warn' },
|
|
17685
|
+
);
|
|
17686
|
+
if (input.rowScoped) {
|
|
17687
|
+
throw new PlayRowProviderBackpressureError(
|
|
17688
|
+
input.provider,
|
|
17689
|
+
decision.retryAtMs,
|
|
17690
|
+
false,
|
|
17691
|
+
);
|
|
17692
|
+
}
|
|
17693
|
+
await this.waitForCallRequeue(input.callRequeueKey, decision.retryAtMs);
|
|
17694
|
+
throw new Error(
|
|
17695
|
+
`Call requeue for ${input.toolId} resumed without suspending the run.`,
|
|
17696
|
+
);
|
|
17697
|
+
}
|
|
17698
|
+
|
|
17699
|
+
/** A run-level durable sleep for one parked call; resumes after `retryAtMs`. */
|
|
17700
|
+
private async waitForCallRequeue(
|
|
17701
|
+
callRequeueKey: string,
|
|
17702
|
+
retryAtMs: number,
|
|
17703
|
+
): Promise<void> {
|
|
17704
|
+
this.assertNoPendingDurableSuspension();
|
|
17705
|
+
const prefix = this.durableBoundaryId(
|
|
17706
|
+
`call-requeue-${callRequeueKey.slice(0, 16)}-`,
|
|
17707
|
+
);
|
|
17708
|
+
let completedWaits = 0;
|
|
17709
|
+
for (const [boundaryId, value] of Object.entries(
|
|
17710
|
+
this.checkpoint.resolvedBoundaries ?? {},
|
|
17711
|
+
)) {
|
|
17712
|
+
if (!boundaryId.startsWith(prefix)) continue;
|
|
17713
|
+
const boundary = assertKnownResolvedBoundary(boundaryId, value);
|
|
17714
|
+
if (boundary?.kind === 'sleep' && boundary.completedAt !== undefined) {
|
|
17715
|
+
completedWaits += 1;
|
|
17716
|
+
}
|
|
17717
|
+
}
|
|
17718
|
+
const boundaryId = `${prefix}${completedWaits}`;
|
|
17719
|
+
const existing = assertKnownResolvedBoundary(
|
|
17720
|
+
boundaryId,
|
|
17721
|
+
this.checkpoint.resolvedBoundaries?.[boundaryId],
|
|
17722
|
+
);
|
|
17723
|
+
const delayMs =
|
|
17724
|
+
existing?.kind === 'sleep'
|
|
17725
|
+
? existing.delayMs
|
|
17726
|
+
: Math.max(1_000, Math.ceil(retryAtMs - Date.now()));
|
|
17727
|
+
const wakeAtMs =
|
|
17728
|
+
existing?.kind === 'sleep' && existing.wakeAtMs !== undefined
|
|
17729
|
+
? existing.wakeAtMs
|
|
17730
|
+
: Date.now() + delayMs;
|
|
17731
|
+
this.checkpoint.resolvedBoundaries = {
|
|
17732
|
+
...(this.checkpoint.resolvedBoundaries ?? {}),
|
|
17733
|
+
[boundaryId]: { ...existing, kind: 'sleep', delayMs, wakeAtMs },
|
|
17734
|
+
};
|
|
17735
|
+
await this.suspendForEarliestSleep({
|
|
17736
|
+
kind: 'sleep',
|
|
17737
|
+
boundaryId,
|
|
17738
|
+
delayMs,
|
|
17739
|
+
wakeAtMs,
|
|
17740
|
+
});
|
|
17741
|
+
}
|
|
17742
|
+
|
|
17358
17743
|
private async waitForProviderBackpressure(
|
|
17359
17744
|
provider: string,
|
|
17360
17745
|
retryAtMs: number,
|
|
@@ -19070,6 +19455,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
19070
19455
|
providerOperationKey,
|
|
19071
19456
|
resultReceipts: receipts,
|
|
19072
19457
|
apiOptions: {
|
|
19458
|
+
...(request.retry ? { retry: request.retry } : {}),
|
|
19073
19459
|
playNodeScope: playNodeScopeForToolCallRequest(request),
|
|
19074
19460
|
durableCallReceiptKey: this.toolTransportReceiptKey({
|
|
19075
19461
|
toolId,
|
|
@@ -19796,6 +20182,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
19796
20182
|
const key = JSON.stringify([
|
|
19797
20183
|
req.toolId,
|
|
19798
20184
|
req.executionAuthScopeDigest ?? '',
|
|
20185
|
+
// Calls with their own `retry` dispatch apart from the native batch.
|
|
20186
|
+
req.retry !== undefined,
|
|
19799
20187
|
]);
|
|
19800
20188
|
if (!byTool.has(key)) byTool.set(key, []);
|
|
19801
20189
|
byTool.get(key)!.push(req);
|
|
@@ -19911,8 +20299,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
19911
20299
|
};
|
|
19912
20300
|
// The cohort reads completed results and publishes successful misses.
|
|
19913
20301
|
// Always-fresh calls have no durable member result and stay below.
|
|
19914
|
-
const operationStrategy =
|
|
19915
|
-
this.#options.getBatchOperationStrategy?.(toolId) ?? null;
|
|
20302
|
+
const operationStrategy = this.batchOperationStrategyFor(requests[0]!);
|
|
19916
20303
|
if (this.durableMappedToolResultsBackedByReceipts) {
|
|
19917
20304
|
const cohortRequests = pendingRequests.filter(
|
|
19918
20305
|
(request) =>
|
|
@@ -20222,6 +20609,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
20222
20609
|
resultReceiptKey: request.receiptKey ?? request.cacheKey,
|
|
20223
20610
|
providerOperationKey,
|
|
20224
20611
|
apiOptions: {
|
|
20612
|
+
...(request.retry ? { retry: request.retry } : {}),
|
|
20225
20613
|
playNodeScope: playNodeScopeForToolCallRequest(request),
|
|
20226
20614
|
executionAuthScopeDigest:
|
|
20227
20615
|
request.executionAuthScopeDigest,
|
|
@@ -20878,10 +21266,14 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
20878
21266
|
const providerAdmissionNoProgressScope = stableDigest(
|
|
20879
21267
|
`admission\u0000${providerNoProgressScope}`,
|
|
20880
21268
|
);
|
|
21269
|
+
// The provider no-progress limit. With durable call retries it is the
|
|
21270
|
+
// Durable retry policy's `rate_limit_429.inCall.noProgressMs` (read below,
|
|
21271
|
+
// once the call's policy context is known); the default is unchanged.
|
|
21272
|
+
let providerNoProgressMaxMs = PROVIDER_NO_PROGRESS_MAX_MS;
|
|
20881
21273
|
const providerNoProgressError = (retryAtMs: number) =>
|
|
20882
21274
|
createToolHttpError(
|
|
20883
21275
|
toolErrorSchemaVersion,
|
|
20884
|
-
`Provider ${provider} made no progress within ${
|
|
21276
|
+
`Provider ${provider} made no progress within ${Math.round(providerNoProgressMaxMs / 60_000)} minutes. Completed work was saved; retry the failed work after the provider recovers.`,
|
|
20885
21277
|
null,
|
|
20886
21278
|
429,
|
|
20887
21279
|
'repairable',
|
|
@@ -20935,6 +21327,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
20935
21327
|
scope: providerNoProgressScope,
|
|
20936
21328
|
retryAtMs: noProgressRetryAtMs,
|
|
20937
21329
|
nowMs: Date.now(),
|
|
21330
|
+
maxMs: providerNoProgressMaxMs,
|
|
20938
21331
|
});
|
|
20939
21332
|
if (!outcome.exhausted) return;
|
|
20940
21333
|
this.runtimeLog(
|
|
@@ -21007,6 +21400,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21007
21400
|
async (span) => {
|
|
21008
21401
|
const httpFailureAttempts =
|
|
21009
21402
|
createToolExecuteHttpFailureAttemptTracker();
|
|
21403
|
+
// Requests the provider received in this burst; a refusal before
|
|
21404
|
+
// dispatch is not one. With the requeue record's count it is what a
|
|
21405
|
+
// call's `retry.maximumAttempts` bounds.
|
|
21406
|
+
let providerSendsThisBurst = 0;
|
|
21010
21407
|
// Snapshot the caller-controlled payload exactly once. The replay
|
|
21011
21408
|
// decision and every physical attempt must refer to the same bytes,
|
|
21012
21409
|
// even if the original object has getters or is later mutated.
|
|
@@ -21293,6 +21690,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21293
21690
|
// lifecycle key; it is not a general retry counter.
|
|
21294
21691
|
let providerRateLimitRetryFromInvocationAttempt: number | null =
|
|
21295
21692
|
savedProviderRetryCursor?.retryFromInvocationAttempt ?? null;
|
|
21693
|
+
// Set when a parked fenced call resumes: its Durable requeue claim.
|
|
21694
|
+
let callRequeueWire: {
|
|
21695
|
+
fromInvocationAttempt: number;
|
|
21696
|
+
parks: number;
|
|
21697
|
+
} | null = null;
|
|
21296
21698
|
const serializedRequestBody = (invocationAttempt: number) =>
|
|
21297
21699
|
JSON.stringify({
|
|
21298
21700
|
payload: shouldResolveAsyncOperationInRuntime
|
|
@@ -21307,6 +21709,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21307
21709
|
providerRateLimitRetryFromInvocationAttempt,
|
|
21308
21710
|
}
|
|
21309
21711
|
: {}),
|
|
21712
|
+
...(callRequeueWire
|
|
21713
|
+
? {
|
|
21714
|
+
requeue_from_invocation_attempt:
|
|
21715
|
+
callRequeueWire.fromInvocationAttempt,
|
|
21716
|
+
requeue_parks: callRequeueWire.parks,
|
|
21717
|
+
}
|
|
21718
|
+
: {}),
|
|
21310
21719
|
// Every call through this execution path acquires a Postgres
|
|
21311
21720
|
// AIMD provider permit before its network dispatch. Keep this
|
|
21312
21721
|
// admission proof distinct from the optional provider fence:
|
|
@@ -21426,6 +21835,162 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21426
21835
|
delete this.checkpoint.providerRetryCursors;
|
|
21427
21836
|
}
|
|
21428
21837
|
};
|
|
21838
|
+
// Durable requeue of a call whose in-call retries were spent. The
|
|
21839
|
+
// state lives in the checkpoint and changes only through
|
|
21840
|
+
// `transitionCallRequeue`; a parked call that runs again is resumed
|
|
21841
|
+
// and retried here, before its first send of this attempt.
|
|
21842
|
+
// A call retries per the live Durable retry policy and its own
|
|
21843
|
+
// `retry`; the policy (`park.enabled` per class) is the live off
|
|
21844
|
+
// switch.
|
|
21845
|
+
const callRequeueKey =
|
|
21846
|
+
callOptsIntoDurableRetry(options?.retry) &&
|
|
21847
|
+
this.#options.durableBoundaries &&
|
|
21848
|
+
// A durable retry must find its own record after a replay, so it
|
|
21849
|
+
// needs a replay-stable receipt key. A per-invocation transport
|
|
21850
|
+
// key (random each attempt) never retries durably.
|
|
21851
|
+
options?.durableCallReceiptKey?.trim() &&
|
|
21852
|
+
durableCallReceiptKey
|
|
21853
|
+
? stableDigest(`call-requeue:${durableCallReceiptKey}`)
|
|
21854
|
+
: null;
|
|
21855
|
+
const durableCallRetryEnabled =
|
|
21856
|
+
callRequeueKey !== null &&
|
|
21857
|
+
!asyncExecutionRecovery &&
|
|
21858
|
+
this.#options.getToolDurableRetryContext !== undefined;
|
|
21859
|
+
if (durableCallRetryEnabled) {
|
|
21860
|
+
// In-call provider pacing gives up after the policy's no-progress
|
|
21861
|
+
// limit for 429s; the default equals PROVIDER_NO_PROGRESS_MAX_MS.
|
|
21862
|
+
try {
|
|
21863
|
+
const retryContext =
|
|
21864
|
+
await this.#options.getToolDurableRetryContext!(toolId);
|
|
21865
|
+
const noProgressMs =
|
|
21866
|
+
retryContext?.policy.policy.classes.rate_limit_429.inCall
|
|
21867
|
+
.noProgressMs;
|
|
21868
|
+
if (typeof noProgressMs === 'number') {
|
|
21869
|
+
providerNoProgressMaxMs = noProgressMs;
|
|
21870
|
+
}
|
|
21871
|
+
} catch (contextError) {
|
|
21872
|
+
this.runtimeLog(
|
|
21873
|
+
`[runtime.call_requeue.unavailable] ${JSON.stringify({
|
|
21874
|
+
tool_id: toolId,
|
|
21875
|
+
error_class: 'rate_limit_429',
|
|
21876
|
+
error:
|
|
21877
|
+
contextError instanceof Error
|
|
21878
|
+
? contextError.message
|
|
21879
|
+
: String(contextError),
|
|
21880
|
+
})}`,
|
|
21881
|
+
{ level: 'error' },
|
|
21882
|
+
);
|
|
21883
|
+
}
|
|
21884
|
+
}
|
|
21885
|
+
/**
|
|
21886
|
+
* A provider hold whose no-progress limit is spent: with durable
|
|
21887
|
+
* call retries the call is retried on a durable timer as
|
|
21888
|
+
* `rate_limit_429` (the next segment starts a fresh in-call
|
|
21889
|
+
* window); otherwise, or once the retries are spent, the
|
|
21890
|
+
* PROVIDER_EXHAUSTED error reaches the Play as before.
|
|
21891
|
+
*/
|
|
21892
|
+
const retryProviderHoldDurablyOrThrow = async (
|
|
21893
|
+
error: unknown,
|
|
21894
|
+
): Promise<never> => {
|
|
21895
|
+
if (
|
|
21896
|
+
durableCallRetryEnabled &&
|
|
21897
|
+
callRequeueKey &&
|
|
21898
|
+
error instanceof ToolExecutionError &&
|
|
21899
|
+
error.code === 'PROVIDER_EXHAUSTED' &&
|
|
21900
|
+
error.origin === 'provider'
|
|
21901
|
+
) {
|
|
21902
|
+
await this.parkExhaustedCallOrFail({
|
|
21903
|
+
toolId,
|
|
21904
|
+
provider,
|
|
21905
|
+
callRequeueKey,
|
|
21906
|
+
status: 429,
|
|
21907
|
+
failure: { errorClass: 'rate_limit_429' },
|
|
21908
|
+
responseText: '',
|
|
21909
|
+
providerServerErrorReplay,
|
|
21910
|
+
toolInput: toolInputSnapshot,
|
|
21911
|
+
invocationAttempt,
|
|
21912
|
+
fenced: usesDurableInvocationFence,
|
|
21913
|
+
rowScoped: Boolean(
|
|
21914
|
+
options?.providerBackpressureMapRows || rowContext.getStore(),
|
|
21915
|
+
),
|
|
21916
|
+
...(options?.retry ? { callRetry: options.retry } : {}),
|
|
21917
|
+
sendsThisBurst: providerSendsThisBurst,
|
|
21918
|
+
writeRecord: writeCallRequeueRecord,
|
|
21919
|
+
});
|
|
21920
|
+
}
|
|
21921
|
+
throw error;
|
|
21922
|
+
};
|
|
21923
|
+
const writeCallRequeueRecord = (record: CallRequeueRecord | null) => {
|
|
21924
|
+
if (!callRequeueKey) return;
|
|
21925
|
+
if (record) {
|
|
21926
|
+
(this.checkpoint.callRequeueStates ??= {})[callRequeueKey] =
|
|
21927
|
+
record;
|
|
21928
|
+
} else if (this.checkpoint.callRequeueStates) {
|
|
21929
|
+
delete this.checkpoint.callRequeueStates[callRequeueKey];
|
|
21930
|
+
}
|
|
21931
|
+
};
|
|
21932
|
+
if (callRequeueKey) {
|
|
21933
|
+
const parked = this.checkpoint.callRequeueStates?.[callRequeueKey];
|
|
21934
|
+
if (
|
|
21935
|
+
parked &&
|
|
21936
|
+
(parked.state === 'parked' ||
|
|
21937
|
+
parked.state === 'waiting_for_billing')
|
|
21938
|
+
) {
|
|
21939
|
+
// A run woken early (by another boundary) keeps waiting for
|
|
21940
|
+
// this call's own deadline; a mapped row's map honors it.
|
|
21941
|
+
if (
|
|
21942
|
+
parked.retryAtMs !== null &&
|
|
21943
|
+
Date.now() < parked.retryAtMs - 1_000 &&
|
|
21944
|
+
!options?.providerBackpressureMapRows &&
|
|
21945
|
+
!rowContext.getStore()
|
|
21946
|
+
) {
|
|
21947
|
+
await this.waitForCallRequeue(callRequeueKey, parked.retryAtMs);
|
|
21948
|
+
}
|
|
21949
|
+
const nowMs = Date.now();
|
|
21950
|
+
// A provider hold retried durably gets a fresh in-call
|
|
21951
|
+
// no-progress window in its new attempt.
|
|
21952
|
+
if (
|
|
21953
|
+
parked.errorClass === 'rate_limit_429' &&
|
|
21954
|
+
this.checkpoint.providerNoProgressStartedAtMsByScope
|
|
21955
|
+
) {
|
|
21956
|
+
delete this.checkpoint.providerNoProgressStartedAtMsByScope[
|
|
21957
|
+
providerNoProgressScope
|
|
21958
|
+
];
|
|
21959
|
+
}
|
|
21960
|
+
const resumed = transitionCallRequeue(parked, 'resume', nowMs);
|
|
21961
|
+
writeCallRequeueRecord(
|
|
21962
|
+
transitionCallRequeue(resumed ?? undefined, 'retry', nowMs),
|
|
21963
|
+
);
|
|
21964
|
+
this.runtimeLog(
|
|
21965
|
+
`[runtime.call_requeue.resumed] ${JSON.stringify({
|
|
21966
|
+
tool_id: toolId,
|
|
21967
|
+
error_class: parked.errorClass,
|
|
21968
|
+
parks: parked.parks,
|
|
21969
|
+
policy_sequence: parked.policySequence,
|
|
21970
|
+
})}`,
|
|
21971
|
+
);
|
|
21972
|
+
}
|
|
21973
|
+
// Any non-terminal record (also an `in_call` one re-executed
|
|
21974
|
+
// after a crash or another suspension) fixes the attempt floor of
|
|
21975
|
+
// the current park segment. A fenced resend claims that segment
|
|
21976
|
+
// so the gateway checks prior outcomes from there; the claim
|
|
21977
|
+
// replaces any saved 429 retry claim, which belongs to an earlier
|
|
21978
|
+
// segment and would no longer name the preceding attempt.
|
|
21979
|
+
const live = this.checkpoint.callRequeueStates?.[callRequeueKey];
|
|
21980
|
+
const segmentFrom = live?.requeueFromInvocationAttempt;
|
|
21981
|
+
if (typeof segmentFrom === 'number') {
|
|
21982
|
+
if (segmentFrom > invocationAttempt) {
|
|
21983
|
+
invocationAttempt = segmentFrom;
|
|
21984
|
+
}
|
|
21985
|
+
if (usesDurableInvocationFence && segmentFrom >= 1) {
|
|
21986
|
+
providerRateLimitRetryFromInvocationAttempt = null;
|
|
21987
|
+
callRequeueWire = {
|
|
21988
|
+
fromInvocationAttempt: segmentFrom,
|
|
21989
|
+
parks: live!.parks,
|
|
21990
|
+
};
|
|
21991
|
+
}
|
|
21992
|
+
}
|
|
21993
|
+
}
|
|
21429
21994
|
const persistProviderRetryCursor = (retryFrom: number) => {
|
|
21430
21995
|
if (!providerRetryCursorKey) return;
|
|
21431
21996
|
const cursor: ProviderRetryCursor = {
|
|
@@ -21708,9 +22273,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
21708
22273
|
this.checkpoint.providerNoProgressStartedAtMsByScope,
|
|
21709
22274
|
scope: providerNoProgressScope,
|
|
21710
22275
|
nowMs: Date.now(),
|
|
22276
|
+
maxMs: providerNoProgressMaxMs,
|
|
21711
22277
|
})
|
|
21712
22278
|
) {
|
|
21713
|
-
|
|
22279
|
+
await retryProviderHoldDurablyOrThrow(
|
|
22280
|
+
providerNoProgressError(Date.now()),
|
|
22281
|
+
);
|
|
21714
22282
|
}
|
|
21715
22283
|
physicalAttempt += 1;
|
|
21716
22284
|
providerConcurrencyGrant = null;
|
|
@@ -22589,14 +23157,18 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
22589
23157
|
if (error instanceof ProviderExhaustedError) {
|
|
22590
23158
|
const retryAtMs = Date.parse(error.retryAt);
|
|
22591
23159
|
const localRetryAtMs = error.localRetryAtMs ?? retryAtMs;
|
|
22592
|
-
|
|
22593
|
-
|
|
22594
|
-
|
|
22595
|
-
|
|
22596
|
-
|
|
22597
|
-
|
|
22598
|
-
|
|
22599
|
-
|
|
23160
|
+
try {
|
|
23161
|
+
observeProviderWait(
|
|
23162
|
+
Number.isFinite(retryAtMs) ? retryAtMs : Date.now() + 1_000,
|
|
23163
|
+
Number.isFinite(localRetryAtMs)
|
|
23164
|
+
? localRetryAtMs
|
|
23165
|
+
: Number.isFinite(retryAtMs)
|
|
23166
|
+
? retryAtMs
|
|
23167
|
+
: Date.now() + 1_000,
|
|
23168
|
+
);
|
|
23169
|
+
} catch (holdError) {
|
|
23170
|
+
await retryProviderHoldDurablyOrThrow(holdError);
|
|
23171
|
+
}
|
|
22600
23172
|
const waitMs = Number.isFinite(localRetryAtMs)
|
|
22601
23173
|
? Math.max(0, Math.ceil(localRetryAtMs - Date.now()))
|
|
22602
23174
|
: 1_000;
|
|
@@ -22977,6 +23549,33 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
22977
23549
|
},
|
|
22978
23550
|
);
|
|
22979
23551
|
}
|
|
23552
|
+
const preDispatchRefusal =
|
|
23553
|
+
failure.reason === 'concurrency_backpressure' ||
|
|
23554
|
+
failure.reason === 'provider_pacing_wait' ||
|
|
23555
|
+
failure.reason === 'runtime_scheduler_capacity' ||
|
|
23556
|
+
failure.reason === 'billing_unavailable_before_dispatch' ||
|
|
23557
|
+
failure.reason === 'gateway_invocation_in_progress';
|
|
23558
|
+
if (!preDispatchRefusal) providerSendsThisBurst += 1;
|
|
23559
|
+
// The call's own `retry` may end this call's in-call retries: a
|
|
23560
|
+
// `nonRetryable` class, or `maximumAttempts` reached by every
|
|
23561
|
+
// request the provider received for the call so far.
|
|
23562
|
+
const stopInCallRetry = callRetryStopsInCallRetry({
|
|
23563
|
+
callRetry: options?.retry,
|
|
23564
|
+
errorClass: options?.retry
|
|
23565
|
+
? durableRetryErrorClassForHttpFailure({
|
|
23566
|
+
status: response.status,
|
|
23567
|
+
failure,
|
|
23568
|
+
responseText: text,
|
|
23569
|
+
})
|
|
23570
|
+
: null,
|
|
23571
|
+
preDispatchRefusal,
|
|
23572
|
+
sends:
|
|
23573
|
+
callRequeueSends(
|
|
23574
|
+
callRequeueKey
|
|
23575
|
+
? this.checkpoint.callRequeueStates?.[callRequeueKey]
|
|
23576
|
+
: undefined,
|
|
23577
|
+
) + providerSendsThisBurst,
|
|
23578
|
+
});
|
|
22980
23579
|
if (failure.reason === 'concurrency_backpressure') {
|
|
22981
23580
|
// Our own relay shed. The classifier keeps it out of provider
|
|
22982
23581
|
// backpressure (origin is not the provider); count it apart
|
|
@@ -23020,15 +23619,21 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
23020
23619
|
? null
|
|
23021
23620
|
: Math.max(0, Math.ceil(providerHoldRetryAtMs - Date.now()));
|
|
23022
23621
|
if (
|
|
23023
|
-
|
|
23024
|
-
failure.
|
|
23622
|
+
!stopInCallRetry &&
|
|
23623
|
+
(failure.backpressureDelayMs !== null ||
|
|
23624
|
+
failure.providerPacingWaitMs !== null)
|
|
23025
23625
|
) {
|
|
23026
|
-
|
|
23027
|
-
|
|
23028
|
-
|
|
23626
|
+
try {
|
|
23627
|
+
observeProviderWait(
|
|
23628
|
+
providerHoldRetryAtMs ?? Date.now() + 1_000,
|
|
23629
|
+
);
|
|
23630
|
+
} catch (holdError) {
|
|
23631
|
+
await retryProviderHoldDurablyOrThrow(holdError);
|
|
23632
|
+
}
|
|
23029
23633
|
}
|
|
23030
23634
|
if (
|
|
23031
23635
|
failure.shouldRetry &&
|
|
23636
|
+
!stopInCallRetry &&
|
|
23032
23637
|
this.#options.durableBoundaries &&
|
|
23033
23638
|
remainingProviderWaitMs !== null &&
|
|
23034
23639
|
!canWaitForProviderInSandbox(remainingProviderWaitMs)
|
|
@@ -23077,6 +23682,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
23077
23682
|
failure.reason === 'billing_unavailable_before_dispatch';
|
|
23078
23683
|
if (
|
|
23079
23684
|
failure.shouldRetry &&
|
|
23685
|
+
!stopInCallRetry &&
|
|
23080
23686
|
(failure.knownNotDispatched ||
|
|
23081
23687
|
failure.reason === 'gateway_invocation_in_progress' ||
|
|
23082
23688
|
// A provider 5xx is sent again with the same provider
|
|
@@ -23204,6 +23810,34 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
23204
23810
|
});
|
|
23205
23811
|
continue;
|
|
23206
23812
|
}
|
|
23813
|
+
// In-call retries are spent. A retryable class parks the call
|
|
23814
|
+
// and requeues it per the Durable retry policy, instead of
|
|
23815
|
+
// throwing into the Play. A fenced call resumes with a requeue
|
|
23816
|
+
// claim the gateway checks per park segment (an older gateway
|
|
23817
|
+
// ignores the claim and refuses the resend, and the row fails as
|
|
23818
|
+
// before). Async recovery keeps
|
|
23819
|
+
// the old behaviour.
|
|
23820
|
+
if (durableCallRetryEnabled && callRequeueKey) {
|
|
23821
|
+
await this.parkExhaustedCallOrFail({
|
|
23822
|
+
toolId,
|
|
23823
|
+
provider,
|
|
23824
|
+
callRequeueKey,
|
|
23825
|
+
status: response.status,
|
|
23826
|
+
failure,
|
|
23827
|
+
responseText: text,
|
|
23828
|
+
providerServerErrorReplay,
|
|
23829
|
+
toolInput: toolInputSnapshot,
|
|
23830
|
+
invocationAttempt,
|
|
23831
|
+
fenced: usesDurableInvocationFence,
|
|
23832
|
+
rowScoped: Boolean(
|
|
23833
|
+
options?.providerBackpressureMapRows ||
|
|
23834
|
+
rowContext.getStore(),
|
|
23835
|
+
),
|
|
23836
|
+
...(options?.retry ? { callRetry: options.retry } : {}),
|
|
23837
|
+
sendsThisBurst: providerSendsThisBurst,
|
|
23838
|
+
writeRecord: writeCallRequeueRecord,
|
|
23839
|
+
});
|
|
23840
|
+
}
|
|
23207
23841
|
// The row failure line is often the only evidence a customer
|
|
23208
23842
|
// or operator sees; carry the identifiers that locate the
|
|
23209
23843
|
// upstream request without the debug transport trace.
|
|
@@ -23226,6 +23860,23 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
23226
23860
|
);
|
|
23227
23861
|
}
|
|
23228
23862
|
const parsed = parseToolExecuteResponse(toolId, responseData);
|
|
23863
|
+
if (callRequeueKey) {
|
|
23864
|
+
const requeued =
|
|
23865
|
+
this.checkpoint.callRequeueStates?.[callRequeueKey];
|
|
23866
|
+
if (requeued) {
|
|
23867
|
+
writeCallRequeueRecord(
|
|
23868
|
+
transitionCallRequeue(requeued, 'succeed', Date.now()),
|
|
23869
|
+
);
|
|
23870
|
+
this.runtimeLog(
|
|
23871
|
+
`[runtime.call_requeue.succeeded] ${JSON.stringify({
|
|
23872
|
+
tool_id: toolId,
|
|
23873
|
+
error_class: requeued.errorClass,
|
|
23874
|
+
parks: requeued.parks,
|
|
23875
|
+
policy_sequence: requeued.policySequence,
|
|
23876
|
+
})}`,
|
|
23877
|
+
);
|
|
23878
|
+
}
|
|
23879
|
+
}
|
|
23229
23880
|
const resolved = shouldResolveAsyncOperationInRuntime
|
|
23230
23881
|
? await this.resolveAsyncOperationInRuntime({
|
|
23231
23882
|
toolId,
|