deepline 0.3.530 → 0.3.532
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +10 -8
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +95 -9
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-execution-relay.ts +139 -35
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-receipt-gateway.ts +438 -38
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/runtime-topology.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machine-lifecycle.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-transient-retry.ts +279 -20
- package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +615 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +16 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +26 -8
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +27 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call-retry-facts.ts +317 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +129 -39
- package/dist/cli/auth-7YWTPQSQ.js +43 -0
- package/dist/cli/{auth-LRWNDQFT.mjs → auth-ZB3NN4E7.mjs} +5 -5
- package/dist/cli/{billing-5FDPWGCG.js → billing-32EF4HJM.js} +82 -82
- package/dist/cli/{billing-7T73MRYF.mjs → billing-5GGO7DQS.mjs} +7 -7
- package/dist/cli/{chunk-7WGMCOM6.js → chunk-2T7YE5UH.js} +2 -2
- package/dist/cli/{chunk-L4QR7CYL.js → chunk-2ZGZBN6D.js} +14 -14
- package/dist/cli/{chunk-J6XSBTEX.mjs → chunk-3NUYO5QO.mjs} +1 -1
- package/dist/cli/{chunk-MVF7ZBJX.mjs → chunk-47UF3DDN.mjs} +1 -1
- package/dist/cli/{chunk-2FLODRM2.js → chunk-4S3ONSLF.js} +13 -13
- package/dist/cli/{chunk-4WPIORJX.js → chunk-64CEFPF4.js} +1 -1
- package/dist/cli/{chunk-QI2LKPW5.mjs → chunk-6LBD6G6U.mjs} +2 -2
- package/dist/cli/{chunk-WWLIDAVT.js → chunk-7S3DJFW5.js} +11 -11
- package/dist/cli/{chunk-BVY4QRVT.mjs → chunk-AOAXIJL2.mjs} +82 -31
- package/dist/cli/{chunk-KUHH7RW4.js → chunk-AQHMHYXX.js} +44 -44
- package/dist/cli/{chunk-WAWOMHWO.mjs → chunk-B77ZRM6M.mjs} +2 -2
- package/dist/cli/{chunk-5B37ER3C.js → chunk-BQ2KAFVQ.js} +3 -3
- package/dist/cli/{chunk-VQMGCNX2.mjs → chunk-C6VCDDDD.mjs} +5 -5
- package/dist/cli/{chunk-3MAHDV5C.mjs → chunk-CRWX26LR.mjs} +1 -1
- package/dist/cli/{chunk-7E7CP5KA.js → chunk-CSMLW5VE.js} +4 -4
- package/dist/cli/{chunk-HCWPX2UP.mjs → chunk-DSNTHXR7.mjs} +2 -2
- package/dist/cli/{chunk-4VQ63Y6S.mjs → chunk-EJLCIQA4.mjs} +5 -5
- package/dist/cli/{chunk-7FCD34YS.mjs → chunk-EVXRQXNV.mjs} +3 -2
- package/dist/cli/{chunk-K4Y6CNFV.mjs → chunk-F2YLC4ZG.mjs} +1 -1
- package/dist/cli/{chunk-YI7QOP6L.js → chunk-FU4MMUGM.js} +16 -16
- package/dist/cli/{chunk-6NG3FRJB.mjs → chunk-GABQIZJR.mjs} +5 -5
- package/dist/cli/{chunk-V4EK7ZZX.js → chunk-GBVTSWL3.js} +98 -98
- package/dist/cli/{chunk-WYI3VMTO.js → chunk-H6OYTU2Y.js} +6 -6
- package/dist/cli/{chunk-C44RZGM5.js → chunk-HR2RDDAC.js} +26 -26
- package/dist/cli/{chunk-XNWS2WJG.mjs → chunk-HREGFD2I.mjs} +1 -1
- package/dist/cli/{chunk-GW76IDID.js → chunk-JJSJ47CA.js} +22 -22
- package/dist/cli/{chunk-32NTC5UD.js → chunk-KEE57BF2.js} +7 -7
- package/dist/cli/{chunk-SJQ7Z3NI.js → chunk-KQW27FSR.js} +132 -81
- package/dist/cli/{chunk-D7Y7I4EE.js → chunk-L5V5SLI7.js} +2 -2
- package/dist/cli/{chunk-VKVLJTW5.js → chunk-MHTKWZM3.js} +9 -9
- package/dist/cli/{chunk-EADHDZW2.js → chunk-NBIDYAN6.js} +6 -6
- package/dist/cli/{chunk-E6L3NEFV.js → chunk-NQDUXVBK.js} +41 -41
- package/dist/cli/{chunk-QWEPCX6L.mjs → chunk-O2A4C4WP.mjs} +2 -2
- package/dist/cli/{chunk-KEXGBXUG.js → chunk-O7JU5GUR.js} +5 -5
- package/dist/cli/{chunk-MVFKZQ7E.js → chunk-QZINISXP.js} +3 -3
- package/dist/cli/{chunk-YVLPGYRS.mjs → chunk-RRCSFOF3.mjs} +1 -1
- package/dist/cli/{chunk-A5MYJM4K.mjs → chunk-S2HHY26V.mjs} +2 -2
- package/dist/cli/{chunk-M4Q4LEMM.js → chunk-SMDX4BM5.js} +2 -2
- package/dist/cli/{chunk-5KX3TWBK.mjs → chunk-T2QY36E3.mjs} +1 -1
- package/dist/cli/{chunk-OUM2V7R6.mjs → chunk-TFWREZYG.mjs} +6 -6
- package/dist/cli/{chunk-QQ4LNSY5.mjs → chunk-THQPLSJD.mjs} +1 -1
- package/dist/cli/{chunk-MHR3XVJD.js → chunk-TS6XF2QP.js} +5 -5
- package/dist/cli/{chunk-WL6GAZBD.js → chunk-V6LUMGVI.js} +3 -2
- package/dist/cli/{chunk-5DJUNUHN.mjs → chunk-VCRCMK7M.mjs} +5 -5
- package/dist/cli/{chunk-VYSQ76RP.js → chunk-VHHD5D44.js} +7 -7
- package/dist/cli/{chunk-KI63L5H3.mjs → chunk-VIC2MI4W.mjs} +2 -2
- package/dist/cli/{chunk-ERMDXXP5.mjs → chunk-VN432I4S.mjs} +1 -1
- package/dist/cli/{chunk-LNZILMVK.mjs → chunk-VWEDIFHT.mjs} +4 -4
- package/dist/cli/{chunk-I2YXEHDO.mjs → chunk-VZKCZO4J.mjs} +3 -3
- package/dist/cli/{chunk-2LKVNWRA.mjs → chunk-W5KSUNTE.mjs} +10 -10
- package/dist/cli/{chunk-X547OW3I.js → chunk-WU33X2QL.js} +16 -16
- package/dist/cli/{chunk-2FLRKNME.mjs → chunk-YM6JAKYP.mjs} +2 -2
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-EFIEDJA2.js → csv-4JBCPMEH.js} +13 -13
- package/dist/cli/{csv-VY2S7KKV.mjs → csv-LM44ZFL3.mjs} +4 -4
- package/dist/cli/{db-D32CBDTN.mjs → db-IFJEGJ6M.mjs} +6 -6
- package/dist/cli/{db-3DLI5TYW.js → db-UVNXGK6L.js} +27 -27
- package/dist/cli/describe-AF73GGH6.js +50 -0
- package/dist/cli/{describe-6MYKK2P3.mjs → describe-TWTOPGII.mjs} +18 -18
- package/dist/cli/{executions-QG3DEEY3.js → executions-3I6RU7AO.js} +8 -8
- package/dist/cli/{executions-U6TPX4RX.mjs → executions-NEV2P5MX.mjs} +6 -6
- package/dist/cli/{feedback-YZ6H4VMQ.mjs → feedback-IO5ZAWKK.mjs} +6 -6
- package/dist/cli/{feedback-ZSPW6NXL.js → feedback-NHO56EWZ.js} +14 -14
- package/dist/cli/git-AOKC6WL3.js +25 -0
- package/dist/cli/{git-ENN72IK4.mjs → git-MQISNZ5F.mjs} +5 -5
- package/dist/cli/index.js +145 -145
- package/dist/cli/index.mjs +44 -44
- package/dist/cli/{legacy-noops-MNA6LWJU.mjs → legacy-noops-DNRJHNQB.mjs} +6 -6
- package/dist/cli/{legacy-noops-Q6EVYIGN.js → legacy-noops-SLAQE7HN.js} +9 -9
- package/dist/cli/{monitors-BUH54HXJ.js → monitors-JRNATYS2.js} +100 -100
- package/dist/cli/{monitors-KENWEEWC.mjs → monitors-NAX7SUAR.mjs} +7 -7
- package/dist/cli/{org-HWOHKYP3.mjs → org-34VCNPUD.mjs} +6 -6
- package/dist/cli/{org-AHWQJMV7.js → org-BHOREX5D.js} +86 -86
- package/dist/cli/{pages-Z5R7NYEF.js → pages-GB337AQG.js} +18 -18
- package/dist/cli/{pages-I7DYTCW6.mjs → pages-ZWVHNJOE.mjs} +6 -6
- package/dist/cli/{play-3LXZB4ED.js → play-DAUQ7OAO.js} +317 -317
- package/dist/cli/{play-ET7CRVWJ.mjs → play-GJ7OEYSB.mjs} +18 -18
- package/dist/cli/{providers-GZSAZVHZ.mjs → providers-KA2RKD6E.mjs} +6 -6
- package/dist/cli/{providers-ZV2E7NGX.js → providers-W7QY5FUK.js} +9 -9
- package/dist/cli/{quickstart-5746NBS2.mjs → quickstart-7KOAL3BD.mjs} +4 -4
- package/dist/cli/{quickstart-VJZAT4RY.js → quickstart-D4DPUR7R.js} +6 -6
- package/dist/cli/{run-WOQ6XMTT.mjs → run-AYJSQED7.mjs} +23 -23
- package/dist/cli/{run-WGUAVYZC.js → run-QFVN2WUQ.js} +41 -41
- package/dist/cli/search-JVCK5AB4.js +33 -0
- package/dist/cli/{search-NNPFJYEW.mjs → search-MEE7OV2B.mjs} +8 -8
- package/dist/cli/{search-output-65HDEEFS.mjs → search-output-G36JH6D6.mjs} +4 -4
- package/dist/cli/{search-output-K4ISMPKD.js → search-output-OW6UPOI6.js} +6 -6
- package/dist/cli/{secrets-NBKGWMF4.js → secrets-CJJQJUJC.js} +15 -15
- package/dist/cli/{secrets-RK44OV3X.mjs → secrets-OFNYIJT6.mjs} +6 -6
- package/dist/cli/{sessions-ULQJJN3J.mjs → sessions-B6VCVU4Z.mjs} +6 -6
- package/dist/cli/sessions-DXN6BQ7Q.js +22 -0
- package/dist/cli/{settings-IHNA7X3Y.js → settings-H4Q524LF.js} +86 -86
- package/dist/cli/{settings-V5ZRL2EF.mjs → settings-PPFLSXDP.mjs} +13 -13
- package/dist/cli/{setup-HTEBFMOQ.js → setup-SJAM7XHR.js} +78 -63
- package/dist/cli/{setup-54VZPJGM.mjs → setup-WI3WDRRE.mjs} +28 -13
- package/dist/cli/skills-6MNJK2VQ.js +37 -0
- package/dist/cli/{skills-3FCPWMHX.mjs → skills-QSRYGMG2.mjs} +8 -8
- package/dist/cli/tools-OT43MSZE.js +57 -0
- package/dist/cli/{tools-2NTDNUQT.mjs → tools-RUC4ULAD.mjs} +17 -17
- package/dist/cli/{update-25MTBTGU.mjs → update-DPWNL2UB.mjs} +10 -10
- package/dist/cli/update-PHOSO3TL.js +35 -0
- package/dist/cli/{views-37K4JNNS.js → views-CVDVQALA.js} +18 -18
- package/dist/cli/{views-OBE5LUSW.mjs → views-JP66QRA3.mjs} +6 -6
- package/dist/cli/{workflow-6YTIHHJH.js → workflow-JM6JUI7I.js} +17 -17
- package/dist/cli/{workflow-HAPCL4K6.mjs → workflow-MVTX2PY3.mjs} +7 -7
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +108 -106
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-QFIXECQV.js +0 -43
- package/dist/cli/describe-U6HM52X6.js +0 -50
- package/dist/cli/git-OBV73OVY.js +0 -25
- package/dist/cli/search-IGHNMXI4.js +0 -33
- package/dist/cli/sessions-ZJNV4SEL.js +0 -22
- package/dist/cli/skills-ZCJ6FOOK.js +0 -37
- package/dist/cli/tools-Q75XC2BS.js +0 -57
- package/dist/cli/update-3G3GO7IE.js +0 -35
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
import { sha256Hex } from '../plays/row-identity';
|
|
2
|
+
import { readProvenanceTag } from './log-provenance';
|
|
3
|
+
import type { PlayRunFailureDetails } from './run-failure';
|
|
4
|
+
import { emitPlayTelemetry } from './runtime-telemetry';
|
|
5
|
+
import {
|
|
6
|
+
TOOL_CALL_ERROR_ORIGINS,
|
|
7
|
+
TOOL_CALL_NETWORK_KINDS,
|
|
8
|
+
TOOL_CALL_RETRY_REASONS,
|
|
9
|
+
type ToolCallErrorOrigin,
|
|
10
|
+
type ToolCallNetworkKind,
|
|
11
|
+
type ToolCallRetryReason,
|
|
12
|
+
} from './tool-call-retry-facts';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Durable summary events: one fixed-size line per logical call that hit
|
|
16
|
+
* trouble (`play.call.finished`) and one per terminal run
|
|
17
|
+
* (`play.run.finished`). They are the source of the Durable dashboards, and
|
|
18
|
+
* the runtime log shippers copy them into their own Axiom dataset,
|
|
19
|
+
* `deepline-durable-events`, as typed top-level fields.
|
|
20
|
+
*
|
|
21
|
+
* Every categorical field is a closed vocabulary declared here, and every
|
|
22
|
+
* mapping into one is an explicit, exhaustive function. Nothing is guessed
|
|
23
|
+
* from message text: the call facts come from structured fields on the
|
|
24
|
+
* runner's `tool_call_completed` / `tool_call_failed` records, and the run
|
|
25
|
+
* cause from the run's `PlayRunFailureDetails`.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/** How a call that hit trouble ended. A clean call emits nothing. */
|
|
29
|
+
export const PLAY_CALL_OUTCOMES = [
|
|
30
|
+
/** It failed at least once, retried, and succeeded. */
|
|
31
|
+
'recovered',
|
|
32
|
+
/** It retried at least once and still failed. */
|
|
33
|
+
'gave_up',
|
|
34
|
+
/** It failed without a retry, or an older runner did not say. */
|
|
35
|
+
'failed',
|
|
36
|
+
] as const;
|
|
37
|
+
export type PlayCallOutcome = (typeof PLAY_CALL_OUTCOMES)[number];
|
|
38
|
+
|
|
39
|
+
/** Whether the retry counters came from the runner or are unknown. */
|
|
40
|
+
export const PLAY_CALL_FACTS_SOURCES = [
|
|
41
|
+
'runner',
|
|
42
|
+
/** An older runner wrote no counters: retries are unknown, not zero. */
|
|
43
|
+
'legacy_runner',
|
|
44
|
+
] as const;
|
|
45
|
+
export type PlayCallFactsSource = (typeof PLAY_CALL_FACTS_SOURCES)[number];
|
|
46
|
+
|
|
47
|
+
/** The kind of error a call hit, for the dashboards' provider · error series. */
|
|
48
|
+
export const PLAY_CALL_ERROR_KINDS = [
|
|
49
|
+
'rate_limit_provider',
|
|
50
|
+
'rate_limit_deepline',
|
|
51
|
+
'provider_5xx',
|
|
52
|
+
'provider_4xx',
|
|
53
|
+
'timeout_network',
|
|
54
|
+
'billing',
|
|
55
|
+
'platform',
|
|
56
|
+
'caller_input',
|
|
57
|
+
/** A runtime error that is not a tool execution failure. */
|
|
58
|
+
'runtime',
|
|
59
|
+
'other',
|
|
60
|
+
/** An older runner's failure line, which carried no error fields. */
|
|
61
|
+
'unknown',
|
|
62
|
+
] as const;
|
|
63
|
+
export type PlayCallErrorKind = (typeof PLAY_CALL_ERROR_KINDS)[number];
|
|
64
|
+
|
|
65
|
+
export const PLAY_RUN_OUTCOMES = ['completed', 'failed'] as const;
|
|
66
|
+
export type PlayRunOutcome = (typeof PLAY_RUN_OUTCOMES)[number];
|
|
67
|
+
|
|
68
|
+
/** Why a run failed. A completed run's cause is `none`. */
|
|
69
|
+
export const PLAY_RUN_CAUSES = [
|
|
70
|
+
'none',
|
|
71
|
+
'customer_code',
|
|
72
|
+
'billing_credit',
|
|
73
|
+
'provider_4xx',
|
|
74
|
+
'provider_5xx_gave_up',
|
|
75
|
+
'rate_limit_gave_up',
|
|
76
|
+
'timeout_network',
|
|
77
|
+
'sandbox_runner',
|
|
78
|
+
'platform_db',
|
|
79
|
+
'durability_refusal',
|
|
80
|
+
/**
|
|
81
|
+
* Every admitted row failed. The rows' own call errors (their
|
|
82
|
+
* `play.call.finished` events) carry the cause.
|
|
83
|
+
*/
|
|
84
|
+
'all_rows_failed',
|
|
85
|
+
/** A failure whose details name no known code, origin or class. */
|
|
86
|
+
'unknown',
|
|
87
|
+
] as const;
|
|
88
|
+
export type PlayRunCause = (typeof PLAY_RUN_CAUSES)[number];
|
|
89
|
+
|
|
90
|
+
const TOKEN = /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,95}$/u;
|
|
91
|
+
const PROVIDER = /^[a-z0-9][a-z0-9_.-]{0,63}$/u;
|
|
92
|
+
const CODE = /^[A-Za-z][A-Za-z0-9_.:-]{0,63}$/u;
|
|
93
|
+
const CLASS_NAME = /^[A-Za-z][A-Za-z0-9_]{0,63}$/u;
|
|
94
|
+
const TOOL_CATEGORIES = [
|
|
95
|
+
'validation',
|
|
96
|
+
'authentication',
|
|
97
|
+
'authorization',
|
|
98
|
+
'rate_limit',
|
|
99
|
+
'network',
|
|
100
|
+
'upstream',
|
|
101
|
+
'billing',
|
|
102
|
+
'conflict',
|
|
103
|
+
'internal',
|
|
104
|
+
'unknown',
|
|
105
|
+
] as const;
|
|
106
|
+
type ToolCategory = (typeof TOOL_CATEGORIES)[number];
|
|
107
|
+
|
|
108
|
+
function token(value: unknown, pattern: RegExp): string | null {
|
|
109
|
+
return typeof value === 'string' && pattern.test(value) ? value : null;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function oneOf<T extends string>(
|
|
113
|
+
value: unknown,
|
|
114
|
+
vocabulary: readonly T[],
|
|
115
|
+
): T | null {
|
|
116
|
+
return typeof value === 'string' &&
|
|
117
|
+
(vocabulary as readonly string[]).includes(value)
|
|
118
|
+
? (value as T)
|
|
119
|
+
: null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function count(value: unknown): number | null {
|
|
123
|
+
return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0
|
|
124
|
+
? value
|
|
125
|
+
: null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function status(value: unknown): number | null {
|
|
129
|
+
return typeof value === 'number' &&
|
|
130
|
+
Number.isSafeInteger(value) &&
|
|
131
|
+
value >= 100 &&
|
|
132
|
+
value <= 599
|
|
133
|
+
? value
|
|
134
|
+
: null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* The error kind for one failure. `reason` is the retry loop's own
|
|
139
|
+
* classification; `status`, `origin`, `category` and `networkKind` are the
|
|
140
|
+
* failure's structured fields. Absent fields are null.
|
|
141
|
+
*/
|
|
142
|
+
export function playCallErrorKind(input: {
|
|
143
|
+
reason: ToolCallRetryReason | null;
|
|
144
|
+
status: number | null;
|
|
145
|
+
origin: ToolCallErrorOrigin | null;
|
|
146
|
+
category: ToolCategory | null;
|
|
147
|
+
networkKind: string | null;
|
|
148
|
+
/** The failure was not a tool execution failure. */
|
|
149
|
+
runtimeError: boolean;
|
|
150
|
+
}): PlayCallErrorKind {
|
|
151
|
+
const { reason, status: httpStatus, origin, category } = input;
|
|
152
|
+
if (reason === 'hard_billing_error' || category === 'billing') {
|
|
153
|
+
return 'billing';
|
|
154
|
+
}
|
|
155
|
+
switch (reason) {
|
|
156
|
+
case 'concurrency_backpressure':
|
|
157
|
+
case 'runtime_scheduler_capacity':
|
|
158
|
+
case 'provider_pacing_wait':
|
|
159
|
+
return 'rate_limit_deepline';
|
|
160
|
+
case 'transport':
|
|
161
|
+
case 'connect':
|
|
162
|
+
case 'edge_gateway_transient':
|
|
163
|
+
return 'timeout_network';
|
|
164
|
+
case 'customer_db_storage_unavailable':
|
|
165
|
+
// Deepline's billing store was unavailable; nothing was sent.
|
|
166
|
+
case 'billing_unavailable_before_dispatch':
|
|
167
|
+
case 'idempotency_in_progress':
|
|
168
|
+
case 'gateway_invocation_in_progress':
|
|
169
|
+
return 'platform';
|
|
170
|
+
case 'rate_limit':
|
|
171
|
+
return origin === 'provider'
|
|
172
|
+
? 'rate_limit_provider'
|
|
173
|
+
: 'rate_limit_deepline';
|
|
174
|
+
case 'provider_server_error':
|
|
175
|
+
return 'provider_5xx';
|
|
176
|
+
case 'retry_safe_transient_5xx':
|
|
177
|
+
case 'unsafe_transient_5xx':
|
|
178
|
+
case 'non_retryable_status':
|
|
179
|
+
case null:
|
|
180
|
+
// Decided by the failure's status, origin and category below.
|
|
181
|
+
break;
|
|
182
|
+
default: {
|
|
183
|
+
const unmapped: never = reason;
|
|
184
|
+
throw new Error(`Unmapped tool call retry reason: ${String(unmapped)}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (httpStatus === 429 || category === 'rate_limit') {
|
|
188
|
+
return origin === 'provider'
|
|
189
|
+
? 'rate_limit_provider'
|
|
190
|
+
: 'rate_limit_deepline';
|
|
191
|
+
}
|
|
192
|
+
if (category === 'network' || input.networkKind !== null) {
|
|
193
|
+
return 'timeout_network';
|
|
194
|
+
}
|
|
195
|
+
if ((httpStatus !== null && httpStatus >= 500) || category === 'upstream') {
|
|
196
|
+
return origin === 'provider' ? 'provider_5xx' : 'platform';
|
|
197
|
+
}
|
|
198
|
+
if (category === 'internal') return 'platform';
|
|
199
|
+
if (origin === 'caller') return 'caller_input';
|
|
200
|
+
if (
|
|
201
|
+
(httpStatus !== null && httpStatus >= 400) ||
|
|
202
|
+
category === 'validation' ||
|
|
203
|
+
category === 'authentication' ||
|
|
204
|
+
category === 'authorization' ||
|
|
205
|
+
category === 'conflict'
|
|
206
|
+
) {
|
|
207
|
+
switch (origin) {
|
|
208
|
+
case 'provider':
|
|
209
|
+
return 'provider_4xx';
|
|
210
|
+
case 'deepline':
|
|
211
|
+
return 'platform';
|
|
212
|
+
case 'unknown':
|
|
213
|
+
case null:
|
|
214
|
+
return 'other';
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return input.runtimeError ? 'runtime' : 'other';
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** One call's summary, read back from its runner record. */
|
|
221
|
+
export type DurableCallSummary = {
|
|
222
|
+
outcome: PlayCallOutcome;
|
|
223
|
+
factsSource: PlayCallFactsSource;
|
|
224
|
+
errorKind: PlayCallErrorKind;
|
|
225
|
+
tool: string | null;
|
|
226
|
+
provider: string | null;
|
|
227
|
+
/** Fingerprint of the authored call key: a join key, never the key itself. */
|
|
228
|
+
callKeyHash: string;
|
|
229
|
+
durationMs: number | null;
|
|
230
|
+
sends: number | null;
|
|
231
|
+
retries: number | null;
|
|
232
|
+
retryWaitMs: number | null;
|
|
233
|
+
retryAfterSeen: boolean | null;
|
|
234
|
+
firstRetryReason: ToolCallRetryReason | null;
|
|
235
|
+
firstRetryStatus: number | null;
|
|
236
|
+
lastErrorReason: ToolCallRetryReason | null;
|
|
237
|
+
lastErrorStatus: number | null;
|
|
238
|
+
/** The last failure's network kind, when it was a network failure. */
|
|
239
|
+
lastErrorNetworkKind: ToolCallNetworkKind | null;
|
|
240
|
+
/** false: the last failed request provably never reached the provider. */
|
|
241
|
+
lastErrorDispatched: false | null;
|
|
242
|
+
errorClass: string | null;
|
|
243
|
+
errorCode: string | null;
|
|
244
|
+
errorCategory: ToolCategory | null;
|
|
245
|
+
errorOrigin: ToolCallErrorOrigin | null;
|
|
246
|
+
errorStatus: number | null;
|
|
247
|
+
/** The record's own text, for an exact dedupe key (`eventId`). */
|
|
248
|
+
recordText: string;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
const RUN_LOG_RECORD_FRAME =
|
|
252
|
+
/^\[[^\]\s]+\] (?:\[(?:debug|info|warn|error)\] )?(\{[\s\S]*\})$/u;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* The call outcome carried by one ingested run-log line, or null.
|
|
256
|
+
*
|
|
257
|
+
* Only runtime-authored records count: untagged or `diagnostic` lines whose
|
|
258
|
+
* whole body is a `tool_call_completed` / `tool_call_failed` JSON object.
|
|
259
|
+
* Customer lines are tagged `user` and never count, whatever they say. A
|
|
260
|
+
* completed call is summarized only when the runner reports at least one
|
|
261
|
+
* retry; an older runner's completed line (no counters) is not, because its
|
|
262
|
+
* retries are unknown. Lines are rejected by substring before any parse, so a
|
|
263
|
+
* clean call costs two `includes` checks.
|
|
264
|
+
*/
|
|
265
|
+
export function durableCallSummaryFromRunLogLine(
|
|
266
|
+
line: unknown,
|
|
267
|
+
): DurableCallSummary | null {
|
|
268
|
+
if (typeof line !== 'string' || !line.includes('"event":"tool_call_')) {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
const failedLine = line.includes('"event":"tool_call_failed"');
|
|
272
|
+
if (
|
|
273
|
+
!failedLine &&
|
|
274
|
+
(!line.includes('"event":"tool_call_completed"') ||
|
|
275
|
+
// A clean or legacy completed call. Customer text inside a JSON string
|
|
276
|
+
// cannot forge either check: its quotes are escaped.
|
|
277
|
+
!line.includes('"retries":') ||
|
|
278
|
+
line.includes('"retries":0,'))
|
|
279
|
+
) {
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
const tagged = readProvenanceTag(line.trim());
|
|
283
|
+
if (tagged.provenance !== null && tagged.provenance !== 'diagnostic') {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
const json = tagged.line.match(RUN_LOG_RECORD_FRAME)?.[1];
|
|
287
|
+
if (!json) return null;
|
|
288
|
+
let parsed: unknown;
|
|
289
|
+
try {
|
|
290
|
+
parsed = JSON.parse(json);
|
|
291
|
+
} catch {
|
|
292
|
+
return null;
|
|
293
|
+
}
|
|
294
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
const record = parsed as Record<string, unknown>;
|
|
298
|
+
const failed = record.event === 'tool_call_failed';
|
|
299
|
+
if (!failed && record.event !== 'tool_call_completed') return null;
|
|
300
|
+
|
|
301
|
+
const retries = count(record.retries);
|
|
302
|
+
const factsSource: PlayCallFactsSource =
|
|
303
|
+
count(record.sends) !== null && retries !== null
|
|
304
|
+
? 'runner'
|
|
305
|
+
: 'legacy_runner';
|
|
306
|
+
let outcome: PlayCallOutcome;
|
|
307
|
+
if (failed) {
|
|
308
|
+
outcome =
|
|
309
|
+
factsSource === 'runner' && retries !== null && retries > 0
|
|
310
|
+
? 'gave_up'
|
|
311
|
+
: 'failed';
|
|
312
|
+
} else {
|
|
313
|
+
if (factsSource !== 'runner' || retries === null || retries === 0) {
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
outcome = 'recovered';
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const firstRetryReason = oneOf(
|
|
320
|
+
record.first_retry_reason,
|
|
321
|
+
TOOL_CALL_RETRY_REASONS,
|
|
322
|
+
);
|
|
323
|
+
const firstRetryStatus = status(record.first_retry_status);
|
|
324
|
+
const firstRetryOrigin = oneOf(
|
|
325
|
+
record.first_retry_origin,
|
|
326
|
+
TOOL_CALL_ERROR_ORIGINS,
|
|
327
|
+
);
|
|
328
|
+
const lastErrorReason = oneOf(
|
|
329
|
+
record.last_error_reason,
|
|
330
|
+
TOOL_CALL_RETRY_REASONS,
|
|
331
|
+
);
|
|
332
|
+
const lastErrorStatus = status(record.last_error_status);
|
|
333
|
+
const lastErrorOrigin = oneOf(
|
|
334
|
+
record.last_error_origin,
|
|
335
|
+
TOOL_CALL_ERROR_ORIGINS,
|
|
336
|
+
);
|
|
337
|
+
const errorClass = failed ? token(record.error_class, CLASS_NAME) : null;
|
|
338
|
+
const errorCode = failed ? token(record.error_code, CODE) : null;
|
|
339
|
+
const errorCategory = failed
|
|
340
|
+
? oneOf(record.error_category, TOOL_CATEGORIES)
|
|
341
|
+
: null;
|
|
342
|
+
const errorOrigin = failed
|
|
343
|
+
? oneOf(record.error_origin, TOOL_CALL_ERROR_ORIGINS)
|
|
344
|
+
: null;
|
|
345
|
+
const errorStatus = failed ? status(record.error_status) : null;
|
|
346
|
+
const errorNetworkKind = failed
|
|
347
|
+
? token(record.error_network_kind, CLASS_NAME)
|
|
348
|
+
: null;
|
|
349
|
+
|
|
350
|
+
let errorKind: PlayCallErrorKind;
|
|
351
|
+
if (outcome === 'recovered') {
|
|
352
|
+
// What the call recovered from: the failure that caused its first retry.
|
|
353
|
+
errorKind = playCallErrorKind({
|
|
354
|
+
reason: firstRetryReason,
|
|
355
|
+
status: firstRetryStatus,
|
|
356
|
+
origin: firstRetryOrigin,
|
|
357
|
+
category: null,
|
|
358
|
+
networkKind: null,
|
|
359
|
+
runtimeError: false,
|
|
360
|
+
});
|
|
361
|
+
} else if (
|
|
362
|
+
errorClass === null &&
|
|
363
|
+
errorCode === null &&
|
|
364
|
+
errorOrigin === null
|
|
365
|
+
) {
|
|
366
|
+
errorKind = 'unknown';
|
|
367
|
+
} else {
|
|
368
|
+
// What the call gave up on: its final error, with the loop's last
|
|
369
|
+
// classification when the final error came from an HTTP response.
|
|
370
|
+
errorKind = playCallErrorKind({
|
|
371
|
+
reason: lastErrorReason,
|
|
372
|
+
status: errorStatus ?? lastErrorStatus,
|
|
373
|
+
origin: errorOrigin ?? lastErrorOrigin,
|
|
374
|
+
category: errorCategory,
|
|
375
|
+
networkKind: errorNetworkKind,
|
|
376
|
+
runtimeError: errorOrigin === null && errorCategory === null,
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
return {
|
|
381
|
+
outcome,
|
|
382
|
+
factsSource,
|
|
383
|
+
errorKind,
|
|
384
|
+
tool: token(record.tool, TOKEN),
|
|
385
|
+
provider: token(record.provider, PROVIDER),
|
|
386
|
+
callKeyHash: sha256Hex(
|
|
387
|
+
typeof record.call_key === 'string' ? record.call_key : '',
|
|
388
|
+
).slice(0, 16),
|
|
389
|
+
durationMs: count(record.duration_ms),
|
|
390
|
+
sends: factsSource === 'runner' ? count(record.sends) : null,
|
|
391
|
+
retries: factsSource === 'runner' ? retries : null,
|
|
392
|
+
retryWaitMs: factsSource === 'runner' ? count(record.retry_wait_ms) : null,
|
|
393
|
+
retryAfterSeen:
|
|
394
|
+
factsSource === 'runner' && typeof record.retry_after_seen === 'boolean'
|
|
395
|
+
? record.retry_after_seen
|
|
396
|
+
: null,
|
|
397
|
+
firstRetryReason,
|
|
398
|
+
firstRetryStatus,
|
|
399
|
+
lastErrorReason,
|
|
400
|
+
lastErrorStatus,
|
|
401
|
+
lastErrorNetworkKind:
|
|
402
|
+
factsSource === 'runner'
|
|
403
|
+
? oneOf(record.last_error_network_kind, TOOL_CALL_NETWORK_KINDS)
|
|
404
|
+
: null,
|
|
405
|
+
lastErrorDispatched:
|
|
406
|
+
factsSource === 'runner' && record.last_error_dispatched === false
|
|
407
|
+
? false
|
|
408
|
+
: null,
|
|
409
|
+
errorClass,
|
|
410
|
+
errorCode,
|
|
411
|
+
errorCategory,
|
|
412
|
+
errorOrigin,
|
|
413
|
+
errorStatus,
|
|
414
|
+
recordText: tagged.line,
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* One line per logical call that hit trouble: `play.call.finished`.
|
|
420
|
+
* Identities come from the ingesting server's authenticated launch. The live
|
|
421
|
+
* stream and a terminal replay can both carry one record, so `eventId` is a
|
|
422
|
+
* digest of the run and the record's exact text (timestamp included): count
|
|
423
|
+
* distinct `eventId` for exact call counts.
|
|
424
|
+
*/
|
|
425
|
+
export function emitPlayCallFinished(input: {
|
|
426
|
+
orgId: string | null;
|
|
427
|
+
runId: string;
|
|
428
|
+
playName: string | null;
|
|
429
|
+
attempt: number | null;
|
|
430
|
+
call: DurableCallSummary;
|
|
431
|
+
}): void {
|
|
432
|
+
const { call } = input;
|
|
433
|
+
emitPlayTelemetry({
|
|
434
|
+
level: call.outcome === 'recovered' ? 'info' : 'warn',
|
|
435
|
+
event: 'play.call.finished',
|
|
436
|
+
tag: '[play.call.finished]',
|
|
437
|
+
fields: {
|
|
438
|
+
eventId: sha256Hex(`${input.runId}\u001f${call.recordText}`).slice(0, 24),
|
|
439
|
+
orgId: input.orgId,
|
|
440
|
+
runId: input.runId,
|
|
441
|
+
playName: input.playName,
|
|
442
|
+
attempt: count(input.attempt),
|
|
443
|
+
outcome: call.outcome,
|
|
444
|
+
factsSource: call.factsSource,
|
|
445
|
+
errorKind: call.errorKind,
|
|
446
|
+
tool: call.tool,
|
|
447
|
+
provider: call.provider,
|
|
448
|
+
callKeyHash: call.callKeyHash,
|
|
449
|
+
durationMs: call.durationMs,
|
|
450
|
+
sends: call.sends,
|
|
451
|
+
retries: call.retries,
|
|
452
|
+
retryWaitMs: call.retryWaitMs,
|
|
453
|
+
retryAfterSeen: call.retryAfterSeen,
|
|
454
|
+
firstRetryReason: call.firstRetryReason,
|
|
455
|
+
firstRetryStatus: call.firstRetryStatus,
|
|
456
|
+
lastErrorReason: call.lastErrorReason,
|
|
457
|
+
lastErrorStatus: call.lastErrorStatus,
|
|
458
|
+
lastErrorNetworkKind: call.lastErrorNetworkKind,
|
|
459
|
+
lastErrorDispatched: call.lastErrorDispatched,
|
|
460
|
+
errorClass: call.errorClass,
|
|
461
|
+
errorCode: call.errorCode,
|
|
462
|
+
errorCategory: call.errorCategory,
|
|
463
|
+
errorOrigin: call.errorOrigin,
|
|
464
|
+
errorStatus: call.errorStatus,
|
|
465
|
+
},
|
|
466
|
+
});
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
const SANDBOX_RUNNER_CODES: ReadonlySet<string> = new Set([
|
|
470
|
+
'RUNTIME_SANDBOX_OOM',
|
|
471
|
+
'RUNTIME_SANDBOX_MEMORY_ABORT',
|
|
472
|
+
'RUNTIME_SANDBOX_KILLED',
|
|
473
|
+
'RUNTIME_SANDBOX_LOST',
|
|
474
|
+
'RUNTIME_SANDBOX_START_FAILED',
|
|
475
|
+
'RUNTIME_SANDBOX_INSPECTION_UNAVAILABLE',
|
|
476
|
+
'RUNTIME_RUNNER_LOST',
|
|
477
|
+
'SANDBOX_CAPACITY_EXCEEDED',
|
|
478
|
+
'MODAL_PAYLOAD_UPLOAD_TIMEOUT',
|
|
479
|
+
]);
|
|
480
|
+
const PLATFORM_DB_CODES: ReadonlySet<string> = new Set([
|
|
481
|
+
'RUNTIME_CONTROL_PLANE_UNAVAILABLE',
|
|
482
|
+
'PLATFORM_DEPLOY_INTERRUPTED',
|
|
483
|
+
'PLATFORM_WORKER_SUBREQUEST_INTERRUPTED',
|
|
484
|
+
'PLATFORM_WORKFLOW_ENDPOINT_INTERRUPTED',
|
|
485
|
+
'RUN_STORAGE_FAILED',
|
|
486
|
+
'WORKSPACE_STORAGE_NOT_READY',
|
|
487
|
+
'WORKSPACE_STORAGE_PLANE_FAILED',
|
|
488
|
+
'BILLING_UNAVAILABLE',
|
|
489
|
+
]);
|
|
490
|
+
const CUSTOMER_CODE_CODES: ReadonlySet<string> = new Set([
|
|
491
|
+
'OUTPUT_TOO_LARGE',
|
|
492
|
+
'PLAY_CALL_DEPTH_EXCEEDED',
|
|
493
|
+
'CTX_RUN_PLAY_INLINE_ONLY',
|
|
494
|
+
]);
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Why a run failed, from its structured failure details (`code`, `phase`,
|
|
498
|
+
* `origin`, `category`, `name`). `null` details mean the failure carried none.
|
|
499
|
+
*/
|
|
500
|
+
export function playRunFailureCause(
|
|
501
|
+
details: Pick<
|
|
502
|
+
PlayRunFailureDetails,
|
|
503
|
+
'code' | 'phase' | 'origin' | 'category' | 'name'
|
|
504
|
+
> | null,
|
|
505
|
+
): PlayRunCause {
|
|
506
|
+
if (!details) return 'unknown';
|
|
507
|
+
const code = typeof details.code === 'string' ? details.code : '';
|
|
508
|
+
const name = typeof details.name === 'string' ? details.name : '';
|
|
509
|
+
if (code.startsWith('DURABLE_REPLAY_') || name.startsWith('DurableReplay')) {
|
|
510
|
+
return 'durability_refusal';
|
|
511
|
+
}
|
|
512
|
+
if (code === 'ALL_ADMITTED_ROWS_FAILED') return 'all_rows_failed';
|
|
513
|
+
if (SANDBOX_RUNNER_CODES.has(code)) return 'sandbox_runner';
|
|
514
|
+
if (PLATFORM_DB_CODES.has(code) || code.startsWith('PLATFORM_')) {
|
|
515
|
+
return 'platform_db';
|
|
516
|
+
}
|
|
517
|
+
if (code === 'RUNTIME_LIMIT_EXCEEDED') return 'timeout_network';
|
|
518
|
+
if (code === 'PROVIDER_EXHAUSTED') return 'rate_limit_gave_up';
|
|
519
|
+
if (CUSTOMER_CODE_CODES.has(code)) return 'customer_code';
|
|
520
|
+
if (details.phase === 'billing' || details.category === 'billing') {
|
|
521
|
+
return 'billing_credit';
|
|
522
|
+
}
|
|
523
|
+
switch (details.origin) {
|
|
524
|
+
case 'provider':
|
|
525
|
+
switch (details.category) {
|
|
526
|
+
case 'rate_limit':
|
|
527
|
+
return 'rate_limit_gave_up';
|
|
528
|
+
case 'network':
|
|
529
|
+
return 'timeout_network';
|
|
530
|
+
case 'upstream':
|
|
531
|
+
case 'internal':
|
|
532
|
+
return 'provider_5xx_gave_up';
|
|
533
|
+
case 'validation':
|
|
534
|
+
case 'authentication':
|
|
535
|
+
case 'authorization':
|
|
536
|
+
case 'conflict':
|
|
537
|
+
return 'provider_4xx';
|
|
538
|
+
default:
|
|
539
|
+
// `unknown`, absent, or a category this build does not know.
|
|
540
|
+
return 'unknown';
|
|
541
|
+
}
|
|
542
|
+
case 'deepline':
|
|
543
|
+
switch (details.category) {
|
|
544
|
+
case 'rate_limit':
|
|
545
|
+
return 'rate_limit_gave_up';
|
|
546
|
+
case 'network':
|
|
547
|
+
return 'timeout_network';
|
|
548
|
+
default:
|
|
549
|
+
return 'platform_db';
|
|
550
|
+
}
|
|
551
|
+
case 'caller':
|
|
552
|
+
return 'customer_code';
|
|
553
|
+
case undefined:
|
|
554
|
+
break;
|
|
555
|
+
default:
|
|
556
|
+
// `unknown`, or an origin this build does not know.
|
|
557
|
+
return 'unknown';
|
|
558
|
+
}
|
|
559
|
+
// No tool origin: an error the Play's own code raised (`RUN_FAILED`).
|
|
560
|
+
return code === 'RUN_FAILED' ? 'customer_code' : 'unknown';
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/** The first structured failure of a failed runner result, if it has one. */
|
|
564
|
+
export function playRunFailureDetailsOf(
|
|
565
|
+
result: unknown,
|
|
566
|
+
): PlayRunFailureDetails | null {
|
|
567
|
+
if (!result || typeof result !== 'object') return null;
|
|
568
|
+
const errors = (result as { errors?: unknown }).errors;
|
|
569
|
+
const first = Array.isArray(errors) ? errors[0] : undefined;
|
|
570
|
+
if (!first || typeof first !== 'object') return null;
|
|
571
|
+
const code = (first as { code?: unknown }).code;
|
|
572
|
+
return typeof code === 'string' ? (first as PlayRunFailureDetails) : null;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* One line per run that reached a terminal state: `play.run.finished`.
|
|
577
|
+
* Emitted by the process that committed the terminal transition, after it
|
|
578
|
+
* committed, so a run is reported once.
|
|
579
|
+
*/
|
|
580
|
+
export function emitPlayRunFinished(input: {
|
|
581
|
+
orgId: string | null;
|
|
582
|
+
runId: string;
|
|
583
|
+
playName: string | null;
|
|
584
|
+
attempt: number | null;
|
|
585
|
+
outcome: PlayRunOutcome;
|
|
586
|
+
failure: PlayRunFailureDetails | null;
|
|
587
|
+
runtimeBackend: string | null;
|
|
588
|
+
triggerSource: string | null;
|
|
589
|
+
/** Where the terminal was committed. */
|
|
590
|
+
committedBy: 'worker' | 'gateway';
|
|
591
|
+
}): void {
|
|
592
|
+
const failure = input.outcome === 'failed' ? input.failure : null;
|
|
593
|
+
emitPlayTelemetry({
|
|
594
|
+
level: input.outcome === 'failed' ? 'warn' : 'info',
|
|
595
|
+
event: 'play.run.finished',
|
|
596
|
+
tag: '[play.run.finished]',
|
|
597
|
+
fields: {
|
|
598
|
+
orgId: input.orgId,
|
|
599
|
+
runId: input.runId,
|
|
600
|
+
playName: input.playName,
|
|
601
|
+
attempt: count(input.attempt),
|
|
602
|
+
outcome: input.outcome,
|
|
603
|
+
cause:
|
|
604
|
+
input.outcome === 'completed' ? 'none' : playRunFailureCause(failure),
|
|
605
|
+
failureCode: token(failure?.code, CODE),
|
|
606
|
+
failurePhase: token(failure?.phase, CLASS_NAME),
|
|
607
|
+
failureOrigin: oneOf(failure?.origin, TOOL_CALL_ERROR_ORIGINS),
|
|
608
|
+
failureCategory: oneOf(failure?.category, TOOL_CATEGORIES),
|
|
609
|
+
failureName: token(failure?.name, CLASS_NAME),
|
|
610
|
+
runtimeBackend: token(input.runtimeBackend, TOKEN),
|
|
611
|
+
triggerSource: token(input.triggerSource, TOKEN),
|
|
612
|
+
committedBy: input.committedBy,
|
|
613
|
+
},
|
|
614
|
+
});
|
|
615
|
+
}
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts
CHANGED
|
@@ -60,7 +60,10 @@ import {
|
|
|
60
60
|
import type { PreloadedRuntimeDbSession } from '../db-session';
|
|
61
61
|
import { parseRenewedPreloadedRuntimeDbSessions } from '../db-session-renewal';
|
|
62
62
|
import { RUNTIME_CLAIM_HEARTBEAT_DIVISOR } from '../runtime-constants';
|
|
63
|
-
import {
|
|
63
|
+
import {
|
|
64
|
+
normalizePlayRunFailure,
|
|
65
|
+
runtimeLimitExceededCause,
|
|
66
|
+
} from '../run-failure';
|
|
64
67
|
import {
|
|
65
68
|
playRunRecoveryLogDetail,
|
|
66
69
|
playRunRecoveryProviderText,
|
|
@@ -373,6 +376,7 @@ import {
|
|
|
373
376
|
emitPlayRunRecoveryDecision,
|
|
374
377
|
emitPlayRuntimeSpan,
|
|
375
378
|
} from '../runtime-telemetry';
|
|
379
|
+
import { emitPlayRunFinished } from '../durable-summary-events';
|
|
376
380
|
|
|
377
381
|
/**
|
|
378
382
|
* A token exchange crosses an HTTP boundary, which otherwise erases the
|
|
@@ -8237,6 +8241,17 @@ export async function recoverAbsurdRuntimeOverdueDetachedRunnerCeilings(input: {
|
|
|
8237
8241
|
skipped += 1;
|
|
8238
8242
|
continue;
|
|
8239
8243
|
}
|
|
8244
|
+
emitPlayRunFinished({
|
|
8245
|
+
orgId: claim.launch.orgId ?? null,
|
|
8246
|
+
runId: claim.runId,
|
|
8247
|
+
playName: claim.launch.playName ?? null,
|
|
8248
|
+
attempt: claim.attempt,
|
|
8249
|
+
outcome: 'failed',
|
|
8250
|
+
failure: normalizePlayRunFailure(failedResult.error),
|
|
8251
|
+
runtimeBackend: claim.launch.runtimeBackend ?? null,
|
|
8252
|
+
triggerSource: claim.launch.triggerSource ?? null,
|
|
8253
|
+
committedBy: 'worker',
|
|
8254
|
+
});
|
|
8240
8255
|
if (absurdRun) {
|
|
8241
8256
|
await cancelAbsurdEngineTaskAfterSchedulerTerminal({
|
|
8242
8257
|
client: input.client,
|