deepline 0.3.528 → 0.3.529
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +60 -0
- package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +22 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +3 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +123 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +203 -44
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +43 -16
- package/dist/cli/auth-P7M7SXM5.js +43 -0
- package/dist/cli/{auth-PPOTNK4T.mjs → auth-V7A6TU4G.mjs} +5 -5
- package/dist/cli/{billing-OEZUQ2K6.mjs → billing-5VBUYPWW.mjs} +6 -6
- package/dist/cli/{billing-3C7T7CUQ.js → billing-XF6SAA5Y.js} +79 -79
- package/dist/cli/{chunk-5MJ4CDAQ.js → chunk-2GV54JFN.js} +44 -44
- package/dist/cli/{chunk-LT4IEJ6V.js → chunk-4722FTYU.js} +16 -16
- package/dist/cli/{chunk-DCVNL5XN.mjs → chunk-4A4OQMJX.mjs} +1 -1
- package/dist/cli/{chunk-R5ZQVQ3K.js → chunk-4BKE63Q7.js} +26 -26
- package/dist/cli/{chunk-KWIKFR7Y.mjs → chunk-5NZEA2YV.mjs} +1 -1
- package/dist/cli/{chunk-IYCRX34W.mjs → chunk-6XZIXDLC.mjs} +5 -5
- package/dist/cli/{chunk-LU4EA3ET.js → chunk-7RTDSHMB.js} +2 -2
- package/dist/cli/{chunk-ZFD5FJCZ.js → chunk-7SRZTSHU.js} +5 -5
- package/dist/cli/{chunk-IJAEYEJM.js → chunk-7Z3ZXSOX.js} +3 -3
- package/dist/cli/{chunk-FXYWEKUK.js → chunk-AP7DNG6D.js} +4 -4
- package/dist/cli/{chunk-RML3VSTN.mjs → chunk-BOWZ3OOU.mjs} +1 -1
- package/dist/cli/{chunk-7X3NLHI7.js → chunk-BRQDN67G.js} +6 -6
- package/dist/cli/{chunk-IM5XQ4DG.mjs → chunk-C2WTS7WY.mjs} +5 -5
- package/dist/cli/{chunk-ULUI2FEM.mjs → chunk-DKX5CGTG.mjs} +1 -1
- package/dist/cli/{chunk-OVZSNBDJ.js → chunk-DPGPXARU.js} +53 -53
- package/dist/cli/{chunk-GP7E4TE4.mjs → chunk-E7CN5GEM.mjs} +2 -2
- package/dist/cli/{chunk-KLGYBOGZ.mjs → chunk-ETCGTKLF.mjs} +1 -1
- package/dist/cli/{chunk-6OLQWQU5.mjs → chunk-EW33RCLA.mjs} +3 -3
- package/dist/cli/{chunk-XD2DRBPH.js → chunk-FCNSJHED.js} +6 -6
- package/dist/cli/{chunk-NCOTOGTK.mjs → chunk-FWC47SCG.mjs} +2 -2
- package/dist/cli/{chunk-GFGFAAY2.mjs → chunk-FXHKNZM2.mjs} +1 -1
- package/dist/cli/{chunk-NZM4KWWV.mjs → chunk-G4SYSUDB.mjs} +5 -5
- package/dist/cli/{chunk-B6YWCGVC.mjs → chunk-GPU4ULMY.mjs} +10 -10
- package/dist/cli/{chunk-B3HQF2CA.js → chunk-H2JAXOPP.js} +11 -11
- package/dist/cli/{chunk-RC5CG5SE.mjs → chunk-HV4UKMBB.mjs} +4 -4
- package/dist/cli/{chunk-T4QPRL3P.mjs → chunk-K55VBSCA.mjs} +3 -3
- package/dist/cli/{chunk-7WZXUAQW.js → chunk-KAI64HV7.js} +7 -7
- package/dist/cli/{chunk-4SBUXDKZ.js → chunk-KSUWW26I.js} +13 -13
- package/dist/cli/{chunk-IXEEXYE2.js → chunk-L3J7IAYE.js} +9 -9
- package/dist/cli/{chunk-237PKFIQ.js → chunk-M47I47FK.js} +14 -14
- package/dist/cli/{chunk-Z44S7VWO.mjs → chunk-NDVCVFZW.mjs} +2 -2
- package/dist/cli/{chunk-MLNH4DK2.js → chunk-NVH6ULDP.js} +22 -22
- package/dist/cli/{chunk-42ZSDTOC.mjs → chunk-NVSMSP2J.mjs} +2 -2
- package/dist/cli/{chunk-RFTBMEWL.js → chunk-OA4FI5ZM.js} +2 -2
- package/dist/cli/{chunk-CMTY6SVY.mjs → chunk-PAAREIKG.mjs} +2 -2
- package/dist/cli/{chunk-PS2UYVAE.mjs → chunk-PJDYY5JL.mjs} +6 -6
- package/dist/cli/{chunk-OGVUT2KM.js → chunk-PNWBODCB.js} +7 -7
- package/dist/cli/{chunk-OEI7YUEF.js → chunk-QTQWPSAK.js} +3 -3
- package/dist/cli/{chunk-AFIAVG5T.mjs → chunk-R62Z4INU.mjs} +2 -2
- package/dist/cli/{chunk-36UD7H7Y.js → chunk-RWY2QLJ4.js} +41 -41
- package/dist/cli/{chunk-ADZGTMLU.js → chunk-TEFO5AS2.js} +98 -98
- package/dist/cli/{chunk-KHVCHFE3.js → chunk-UMCEXTRM.js} +16 -16
- package/dist/cli/{chunk-Z25KC5V2.mjs → chunk-XE4PQE2O.mjs} +1 -1
- package/dist/cli/{chunk-GCBFSFLA.js → chunk-XEZSORKG.js} +5 -5
- package/dist/cli/{chunk-WXHBD6H7.js → chunk-XZ6OY3BH.js} +1 -1
- package/dist/cli/{chunk-SP2KZ7SH.mjs → chunk-Y4P6XJHU.mjs} +1 -1
- package/dist/cli/{chunk-HJVNCRXY.mjs → chunk-YVJJEMNQ.mjs} +1 -1
- package/dist/cli/{chunk-G7RTPKRJ.js → chunk-ZEIN5YJS.js} +2 -2
- package/dist/cli/{chunk-FPHAUP55.mjs → chunk-ZULLXAJJ.mjs} +5 -5
- package/dist/cli/{chunk-GSBKODMU.mjs → chunk-ZYMX7KZE.mjs} +2 -2
- package/dist/cli/{csv-K7TRWOFJ.mjs → csv-IHLVHG35.mjs} +4 -4
- package/dist/cli/{csv-OTRVTHD2.js → csv-VEKMGGOE.js} +13 -13
- package/dist/cli/{db-UO2ZFLFN.js → db-NTFFISQG.js} +27 -27
- package/dist/cli/{db-C7GQU3TZ.mjs → db-RKLVYARP.mjs} +6 -6
- package/dist/cli/{describe-LG4CPTIV.mjs → describe-62ELB5DZ.mjs} +18 -18
- package/dist/cli/describe-JXOGKT6C.js +50 -0
- package/dist/cli/{executions-P3INNVZE.mjs → executions-5BMZW4C7.mjs} +6 -6
- package/dist/cli/{executions-LHFVPO7E.js → executions-X7NMKMXW.js} +8 -8
- package/dist/cli/{feedback-M3HZQAWX.js → feedback-RDN5O4AT.js} +14 -14
- package/dist/cli/{feedback-H22FWG63.mjs → feedback-UHHWCIFD.mjs} +6 -6
- package/dist/cli/{git-G2N7PVFI.mjs → git-3M33GKOW.mjs} +5 -5
- package/dist/cli/git-7VZGGIGZ.js +25 -0
- package/dist/cli/index.js +141 -141
- package/dist/cli/index.mjs +43 -43
- package/dist/cli/{legacy-noops-LDYSWTL2.mjs → legacy-noops-7RVRPF5B.mjs} +6 -6
- package/dist/cli/{legacy-noops-2RVROWBY.js → legacy-noops-ENKN6JU4.js} +9 -9
- package/dist/cli/{monitors-IYT3VON7.mjs → monitors-FJPDMUQ6.mjs} +7 -7
- package/dist/cli/{monitors-U4RE6KN5.js → monitors-YOWDFGIR.js} +100 -100
- package/dist/cli/{org-SO52ZGRP.js → org-4GBLI75H.js} +86 -86
- package/dist/cli/{org-R3JE22GS.mjs → org-H24LOZAC.mjs} +6 -6
- package/dist/cli/{pages-5RLT5YTF.mjs → pages-BKM2D6BV.mjs} +6 -6
- package/dist/cli/{pages-SWXJQJXH.js → pages-WWVLYB5K.js} +18 -18
- package/dist/cli/{play-2ELYCSXZ.mjs → play-M3CSYH3A.mjs} +18 -18
- package/dist/cli/{play-J4UXOQOJ.js → play-TXHKCG6B.js} +317 -317
- package/dist/cli/{providers-IXITXHTS.mjs → providers-EW5WTMTX.mjs} +6 -6
- package/dist/cli/{providers-VVUDGV2D.js → providers-XL4SNFHU.js} +9 -9
- package/dist/cli/{quickstart-XPH6MT47.js → quickstart-AFQ5MCDL.js} +6 -6
- package/dist/cli/{quickstart-HQCGDPPL.mjs → quickstart-SZSLS553.mjs} +4 -4
- package/dist/cli/{run-OR646AC6.js → run-MOFHGYSN.js} +41 -41
- package/dist/cli/{run-H2HQPWC4.mjs → run-TWXFNH6U.mjs} +23 -23
- package/dist/cli/{search-MBPI5SBW.mjs → search-2SW4V4IR.mjs} +8 -8
- package/dist/cli/search-V2AGWRLO.js +33 -0
- package/dist/cli/{search-output-YGNSHBXX.js → search-output-CJGRPJYD.js} +6 -6
- package/dist/cli/{search-output-CYOMJNRV.mjs → search-output-I6DNYXNT.mjs} +4 -4
- package/dist/cli/{secrets-NK2CN7WI.mjs → secrets-4XXLR6QO.mjs} +6 -6
- package/dist/cli/{secrets-HVZKNNLZ.js → secrets-SD43HSLX.js} +15 -15
- package/dist/cli/{sessions-NY4G427U.mjs → sessions-7G32HW5R.mjs} +6 -6
- package/dist/cli/sessions-FIRDFPIZ.js +22 -0
- package/dist/cli/{settings-RC4FGYY2.mjs → settings-HSYRY2L5.mjs} +13 -13
- package/dist/cli/{settings-PVJRDEN2.js → settings-SYEBDDDJ.js} +86 -86
- package/dist/cli/{setup-B7QB4YV2.js → setup-VTWCVCTK.js} +50 -50
- package/dist/cli/{setup-YT3XSY6X.mjs → setup-XZVBPKZK.mjs} +10 -10
- package/dist/cli/{skills-5ILFNAHR.mjs → skills-OMPEUMRT.mjs} +8 -8
- package/dist/cli/skills-RUY7CION.js +37 -0
- package/dist/cli/tools-KLIW7G6T.js +57 -0
- package/dist/cli/{tools-7PAY32OZ.mjs → tools-UEDNJI4G.mjs} +17 -17
- package/dist/cli/{update-Z27QYB6O.mjs → update-4YVCUSSI.mjs} +10 -10
- package/dist/cli/update-FDUZRKKU.js +35 -0
- package/dist/cli/{views-2IANF6KR.mjs → views-4FP4AJQ2.mjs} +6 -6
- package/dist/cli/{views-NP2SCMOV.js → views-ZCCSKWMP.js} +18 -18
- package/dist/cli/{workflow-CAMEZLLY.mjs → workflow-A2D5FALP.mjs} +7 -7
- package/dist/cli/{workflow-2GNQL646.js → workflow-SM4OD4VJ.js} +17 -17
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +104 -104
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-CWJZYLTB.js +0 -43
- package/dist/cli/describe-IK4UYJ5M.js +0 -50
- package/dist/cli/git-72ADWRUQ.js +0 -25
- package/dist/cli/search-D27DZH2D.js +0 -33
- package/dist/cli/sessions-MTISSOZ4.js +0 -22
- package/dist/cli/skills-BHF35NLX.js +0 -37
- package/dist/cli/tools-W5BZ37L6.js +0 -57
- package/dist/cli/update-M65CGK42.js +0 -35
|
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
|
|
|
205
205
|
// getters keep their established compatibility behavior.
|
|
206
206
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
207
207
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
208
|
-
version: '0.3.
|
|
208
|
+
version: '0.3.529',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -4423,6 +4423,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
4423
4423
|
replayMismatchPolicy?: () => Promise<ReplayMismatchPolicy>;
|
|
4424
4424
|
/** See `executeWithFreshnessReceipt`. */
|
|
4425
4425
|
legacyRequestIdentities?: () => Promise<readonly string[] | null>;
|
|
4426
|
+
/** See `executeWithFreshnessReceipt`. */
|
|
4427
|
+
legacyOwnOccurrenceIdentities?: () => Promise<readonly string[]>;
|
|
4426
4428
|
operationKeyEncodesRequest?: true;
|
|
4427
4429
|
}): Promise<T> {
|
|
4428
4430
|
const orgId = this.#options.orgId?.trim();
|
|
@@ -4447,6 +4449,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
4447
4449
|
...(input.legacyRequestIdentities
|
|
4448
4450
|
? { legacyRequestIdentities: input.legacyRequestIdentities }
|
|
4449
4451
|
: {}),
|
|
4452
|
+
...(input.legacyOwnOccurrenceIdentities
|
|
4453
|
+
? {
|
|
4454
|
+
legacyOwnOccurrenceIdentities: input.legacyOwnOccurrenceIdentities,
|
|
4455
|
+
}
|
|
4456
|
+
: {}),
|
|
4450
4457
|
...(input.replayMismatchPolicy
|
|
4451
4458
|
? { replayMismatchPolicy: input.replayMismatchPolicy }
|
|
4452
4459
|
: {}),
|
|
@@ -15010,6 +15017,55 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
15010
15017
|
// operation key.
|
|
15011
15018
|
return cacheKeys;
|
|
15012
15019
|
};
|
|
15020
|
+
/**
|
|
15021
|
+
* An invocation-scoped tool scoped its recorded result keys by the run
|
|
15022
|
+
* and its logical call id: the digest of its tool-layer occurrence key
|
|
15023
|
+
* (authored id, row/workflow scope and request identity) and its
|
|
15024
|
+
* occurrence index among identical requests. Recomputed for this call's
|
|
15025
|
+
* own reserved index, an exact match names the same (id, scope, request,
|
|
15026
|
+
* index) occurrence. A miss proves nothing: an older build numbered
|
|
15027
|
+
* occurrences at the tool layer, so a recovered sibling may have shifted
|
|
15028
|
+
* the index. Those calls execute as before.
|
|
15029
|
+
*/
|
|
15030
|
+
const ownOccurrenceIdentities =
|
|
15031
|
+
(staleAfterSeconds: number | null | undefined) => async () => {
|
|
15032
|
+
if (
|
|
15033
|
+
reservedCallIndexKey === undefined ||
|
|
15034
|
+
reservedCallIndex === undefined
|
|
15035
|
+
) {
|
|
15036
|
+
return [];
|
|
15037
|
+
}
|
|
15038
|
+
const [idempotencyScope, eventWait] = await Promise.all([
|
|
15039
|
+
this.#options.getToolIdempotencyScope?.(toolId),
|
|
15040
|
+
this.#options.getIntegrationEventWaitHandler?.(toolId),
|
|
15041
|
+
]);
|
|
15042
|
+
if (eventWait || idempotencyScope !== 'invocation') return [];
|
|
15043
|
+
const identity = {
|
|
15044
|
+
toolId,
|
|
15045
|
+
requestInput,
|
|
15046
|
+
executionAuthScopeDigest: authScope?.trim() || null,
|
|
15047
|
+
staleAfterSeconds: this.effectiveToolCallCachePolicy({
|
|
15048
|
+
...options,
|
|
15049
|
+
force: true,
|
|
15050
|
+
staleAfterSeconds,
|
|
15051
|
+
}).staleAfterSeconds,
|
|
15052
|
+
};
|
|
15053
|
+
const [keys, legacy] = await Promise.all([
|
|
15054
|
+
this.compatibleDurableToolCallCacheKeys(identity),
|
|
15055
|
+
this.legacyDurableToolCallCacheKey(identity),
|
|
15056
|
+
]);
|
|
15057
|
+
const invocationIdentity = `${this.historyRunId}:${stableDigest(
|
|
15058
|
+
`${reservedCallIndexKey}:${reservedCallIndex}`,
|
|
15059
|
+
)}`;
|
|
15060
|
+
return (legacy ? [...keys, legacy] : keys).map((receiptKey) =>
|
|
15061
|
+
scopeToolReceiptToInvocation({
|
|
15062
|
+
orgId: this.#options.orgId,
|
|
15063
|
+
toolId,
|
|
15064
|
+
receiptKey,
|
|
15065
|
+
invocationIdentity,
|
|
15066
|
+
}),
|
|
15067
|
+
);
|
|
15068
|
+
};
|
|
15013
15069
|
|
|
15014
15070
|
if (
|
|
15015
15071
|
isAlwaysFreshIntegrationWriteTool(toolId) &&
|
|
@@ -15027,6 +15083,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
15027
15083
|
invocationId,
|
|
15028
15084
|
policy: { requested: policy.requested, effective: 0 },
|
|
15029
15085
|
legacyRequestIdentities: once(legacyIdentities(0)),
|
|
15086
|
+
legacyOwnOccurrenceIdentities: once(ownOccurrenceIdentities(0)),
|
|
15030
15087
|
execute: async (_publication, replay) =>
|
|
15031
15088
|
await this.executeToolLegacyInternal(
|
|
15032
15089
|
key,
|
|
@@ -15082,6 +15139,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
15082
15139
|
legacyRequestIdentities: once(
|
|
15083
15140
|
legacyIdentities(options?.staleAfterSeconds),
|
|
15084
15141
|
),
|
|
15142
|
+
legacyOwnOccurrenceIdentities: once(
|
|
15143
|
+
ownOccurrenceIdentities(options?.staleAfterSeconds),
|
|
15144
|
+
),
|
|
15085
15145
|
...(publishLatestOnRefresh
|
|
15086
15146
|
? { publishLatestOnRefresh: true as const }
|
|
15087
15147
|
: {}),
|
|
@@ -408,6 +408,14 @@ export async function executeWithFreshnessReceipt<T>(input: {
|
|
|
408
408
|
* of its recorded identities is in this set. Omitted: no proof exists.
|
|
409
409
|
*/
|
|
410
410
|
legacyRequestIdentities?: () => Promise<readonly string[] | null>;
|
|
411
|
+
/**
|
|
412
|
+
* Identities that can only PROVE an unbound recorded operation is this
|
|
413
|
+
* occurrence's, never disprove it: an invocation-scoped tool's result keys
|
|
414
|
+
* recomputed for this call's own occurrence index. A match reuses the
|
|
415
|
+
* record; a miss proves nothing, so the call is decided as if this were
|
|
416
|
+
* absent.
|
|
417
|
+
*/
|
|
418
|
+
legacyOwnOccurrenceIdentities?: () => Promise<readonly string[]>;
|
|
411
419
|
/**
|
|
412
420
|
* The operation key itself already encodes the authored request (a
|
|
413
421
|
* `ctx.step` with a `semanticKey`): an unbound receipt under it can only be
|
|
@@ -854,7 +862,8 @@ export async function executeWithFreshnessReceipt<T>(input: {
|
|
|
854
862
|
: await recordedIdentitiesOf(recorded);
|
|
855
863
|
if (
|
|
856
864
|
input.operationKeyEncodesRequest === true ||
|
|
857
|
-
(await recordedIdentityMatches(recordedIdentities))
|
|
865
|
+
(await recordedIdentityMatches(recordedIdentities)) ||
|
|
866
|
+
(await recordedOwnOccurrenceMatches(recordedIdentities))
|
|
858
867
|
) {
|
|
859
868
|
input.onLegacyRecoveryProven?.();
|
|
860
869
|
return outcome(recorded, 'operation_recovery');
|
|
@@ -911,6 +920,18 @@ export async function executeWithFreshnessReceipt<T>(input: {
|
|
|
911
920
|
}
|
|
912
921
|
return resultRequestIdentities(referent.output);
|
|
913
922
|
};
|
|
923
|
+
const recordedOwnOccurrenceMatches = async (
|
|
924
|
+
recordedIdentities: readonly string[],
|
|
925
|
+
): Promise<boolean> => {
|
|
926
|
+
if (
|
|
927
|
+
!input.legacyOwnOccurrenceIdentities ||
|
|
928
|
+
recordedIdentities.length === 0
|
|
929
|
+
) {
|
|
930
|
+
return false;
|
|
931
|
+
}
|
|
932
|
+
const current = new Set(await input.legacyOwnOccurrenceIdentities());
|
|
933
|
+
return recordedIdentities.some((identity) => current.has(identity));
|
|
934
|
+
};
|
|
914
935
|
const recordedIdentityMatches = async (
|
|
915
936
|
recordedIdentities: readonly string[],
|
|
916
937
|
): Promise<boolean> => {
|
|
@@ -93,8 +93,9 @@ export const RUNTIME_CAPACITY_POLICY = {
|
|
|
93
93
|
* an Absurd execution slot. The fleet-wide limiter paces lifecycle
|
|
94
94
|
* admissions; this semaphore bounds concurrent create/retry ladders in one
|
|
95
95
|
* worker process. A run lends its execution slot from taking a permit
|
|
96
|
-
* until it gets a slot back after its create,
|
|
97
|
-
* 8 slots + twice this many
|
|
96
|
+
* until it gets a slot back after its create, and during its pre-park
|
|
97
|
+
* lifecycle flush, so a worker holds at most 8 slots + twice this many
|
|
98
|
+
* runs + 10 flush loans (`ABSURD_RUNTIME_WORKER_MAX_LENT_SLOTS`).
|
|
98
99
|
*
|
|
99
100
|
* Ten lets the two warm workers reach the limiter's 10 starts a second on
|
|
100
101
|
* their own: a create took 1.5-2.2 s mean in the 2026-11-12 bursts, so
|
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
createTelemetry,
|
|
3
3
|
TELEMETRY_TRIAGE_SCHEMA_VERSION,
|
|
4
4
|
} from '../observability/telemetry';
|
|
5
|
+
import { sha256Hex } from '../plays/row-identity';
|
|
6
|
+
import { readProvenanceTag } from './log-provenance';
|
|
5
7
|
|
|
6
8
|
type PlayRuntimeTelemetryInput = {
|
|
7
9
|
phase: string;
|
|
@@ -353,3 +355,124 @@ export function emitPlayRunResumeDecision(input: PlayRunResumeDecision): void {
|
|
|
353
355
|
},
|
|
354
356
|
});
|
|
355
357
|
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* A runner-decided durable replay refusal, read back from the structured
|
|
361
|
+
* `durable_replay_refused` run-log record the runner writes where it refuses
|
|
362
|
+
* (`reportReplayRefusal` in `context.ts`). Runner stderr is not shipped from
|
|
363
|
+
* Modal or Daytona sandboxes, so the server that ingests the run's log lines
|
|
364
|
+
* re-emits each record as one fleet-visible line.
|
|
365
|
+
*/
|
|
366
|
+
export type DurableReplayRefusalRecord = {
|
|
367
|
+
code: string;
|
|
368
|
+
operation: string;
|
|
369
|
+
rung: string;
|
|
370
|
+
reason: string;
|
|
371
|
+
slot: string | null;
|
|
372
|
+
ordinal: number | null;
|
|
373
|
+
/** The runner's running count for this code, operation and authored id. */
|
|
374
|
+
refusalCount: number;
|
|
375
|
+
/** Fingerprint of the authored call id: a dedupe key, never the id itself. */
|
|
376
|
+
callKeyHash: string;
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
const RUN_LOG_RECORD_FRAME =
|
|
380
|
+
/^\[[^\]\s]+\] (?:\[(?:debug|info|warn|error)\] )?(\{[\s\S]*\})$/u;
|
|
381
|
+
const DURABLE_REPLAY_REFUSAL_CODE = /^DURABLE_REPLAY_[A-Z_]{1,64}$/;
|
|
382
|
+
|
|
383
|
+
function shortFingerprint(value: string): string {
|
|
384
|
+
return sha256Hex(value).slice(0, 16);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* The refusal carried by one ingested run-log line, or null. Only the
|
|
389
|
+
* runtime's own structured record counts: a customer-authored line
|
|
390
|
+
* (`ctx.log` and captured console output are always tagged `user`) never
|
|
391
|
+
* does, whatever its text, and the record must be the line's whole JSON
|
|
392
|
+
* object with `event: 'durable_replay_refused'`. The runner already
|
|
393
|
+
* rate-limits each refusal key to counts 1, 2, 4, 8 and so on; a record off
|
|
394
|
+
* that sequence is not forwarded, so the server line keeps the same limit.
|
|
395
|
+
*/
|
|
396
|
+
export function durableReplayRefusalFromRunLogLine(
|
|
397
|
+
line: unknown,
|
|
398
|
+
): DurableReplayRefusalRecord | null {
|
|
399
|
+
if (typeof line !== 'string' || line.length === 0) return null;
|
|
400
|
+
const tagged = readProvenanceTag(line.trim());
|
|
401
|
+
if (tagged.provenance !== null && tagged.provenance !== 'diagnostic') {
|
|
402
|
+
return null;
|
|
403
|
+
}
|
|
404
|
+
const json = tagged.line.match(RUN_LOG_RECORD_FRAME)?.[1];
|
|
405
|
+
if (!json) return null;
|
|
406
|
+
let record: unknown;
|
|
407
|
+
try {
|
|
408
|
+
record = JSON.parse(json);
|
|
409
|
+
} catch {
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
if (!record || typeof record !== 'object' || Array.isArray(record)) {
|
|
413
|
+
return null;
|
|
414
|
+
}
|
|
415
|
+
const fields = record as Record<string, unknown>;
|
|
416
|
+
if (fields.event !== 'durable_replay_refused') return null;
|
|
417
|
+
const code = fields.code;
|
|
418
|
+
if (typeof code !== 'string' || !DURABLE_REPLAY_REFUSAL_CODE.test(code)) {
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
421
|
+
const refusalCount = durabilityDecisionCount(fields.refusal_count);
|
|
422
|
+
if (
|
|
423
|
+
refusalCount === null ||
|
|
424
|
+
refusalCount < 1 ||
|
|
425
|
+
(refusalCount & (refusalCount - 1)) !== 0
|
|
426
|
+
) {
|
|
427
|
+
return null;
|
|
428
|
+
}
|
|
429
|
+
return {
|
|
430
|
+
code,
|
|
431
|
+
operation: durabilityDecisionReason(fields.operation),
|
|
432
|
+
rung: durabilityDecisionReason(fields.rung),
|
|
433
|
+
reason: durabilityDecisionReason(fields.reason),
|
|
434
|
+
slot:
|
|
435
|
+
fields.slot === undefined || fields.slot === null
|
|
436
|
+
? null
|
|
437
|
+
: durabilityDecisionReason(fields.slot),
|
|
438
|
+
ordinal: durabilityDecisionCount(fields.ordinal),
|
|
439
|
+
refusalCount,
|
|
440
|
+
callKeyHash: shortFingerprint(
|
|
441
|
+
typeof fields.call_key === 'string' ? fields.call_key : '',
|
|
442
|
+
),
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* One line per forwarded runner refusal: `play.run.replay_refused`. Identities
|
|
448
|
+
* come from the ingesting server's authenticated launch, not from the record.
|
|
449
|
+
* Distinct refusals are `dcount(runId, attempt, callKeyHash, code,
|
|
450
|
+
* operation, refusalCount)`: live ingest and terminal replay can both carry one record.
|
|
451
|
+
*/
|
|
452
|
+
export function emitPlayRunReplayRefusal(input: {
|
|
453
|
+
orgId: string | null;
|
|
454
|
+
runId: string;
|
|
455
|
+
playName: string | null;
|
|
456
|
+
attempt: number | null;
|
|
457
|
+
refusal: DurableReplayRefusalRecord;
|
|
458
|
+
}): void {
|
|
459
|
+
emitPlayTelemetry({
|
|
460
|
+
level: 'warn',
|
|
461
|
+
event: 'play.run.replay_refused',
|
|
462
|
+
tag: '[play.run.replay_refused]',
|
|
463
|
+
fields: {
|
|
464
|
+
orgId: input.orgId,
|
|
465
|
+
runId: input.runId,
|
|
466
|
+
playName: input.playName,
|
|
467
|
+
attempt: durabilityDecisionCount(input.attempt),
|
|
468
|
+
code: input.refusal.code,
|
|
469
|
+
operation: input.refusal.operation,
|
|
470
|
+
rung: input.refusal.rung,
|
|
471
|
+
reason: input.refusal.reason,
|
|
472
|
+
slot: input.refusal.slot,
|
|
473
|
+
ordinal: input.refusal.ordinal,
|
|
474
|
+
refusalCount: input.refusal.refusalCount,
|
|
475
|
+
callKeyHash: input.refusal.callKeyHash,
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
}
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts
CHANGED
|
@@ -457,12 +457,98 @@ export const ABSURD_RUNTIME_WORKER_SLOTS =
|
|
|
457
457
|
* inside their slots, and the finished runs waited for those creates to end
|
|
458
458
|
* before they could stage (round 43357298524-2: 16 such creates, up to 3.1 s
|
|
459
459
|
* of waiting with a ready sandbox, and no claims for 4 s on each warm worker).
|
|
460
|
-
*
|
|
461
|
-
*
|
|
460
|
+
* On top of those, `ABSURD_RUNTIME_WORKER_MAX_FLUSH_LOANS` runs may lend their
|
|
461
|
+
* slot while the pre-park lifecycle flush waits on the app, so flush loans can
|
|
462
|
+
* never use up the create loans. The worker holds at most
|
|
463
|
+
* slots + 2 x permits + flush loans runs; creates stay bounded by the permits,
|
|
464
|
+
* and pre-create work and staging by `slots`.
|
|
462
465
|
*/
|
|
466
|
+
export const ABSURD_RUNTIME_WORKER_MAX_FLUSH_LOANS = 10;
|
|
463
467
|
export const ABSURD_RUNTIME_WORKER_MAX_LENT_SLOTS =
|
|
464
468
|
2 *
|
|
465
|
-
|
|
469
|
+
RUNTIME_CAPACITY_POLICY.sandboxAcquisition
|
|
470
|
+
.daytonaConcurrentStartsPerProcess +
|
|
471
|
+
ABSURD_RUNTIME_WORKER_MAX_FLUSH_LOANS;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Process-wide count of flush loans, against `max`. A flush takes a loan only
|
|
475
|
+
* while one is free here and the engine still has lending budget; otherwise
|
|
476
|
+
* it flushes in its slot, as before.
|
|
477
|
+
*/
|
|
478
|
+
export function createAbsurdFlushLoanBudget(max: number): {
|
|
479
|
+
tryTake(): boolean;
|
|
480
|
+
give(): void;
|
|
481
|
+
outstanding(): number;
|
|
482
|
+
} {
|
|
483
|
+
let out = 0;
|
|
484
|
+
return {
|
|
485
|
+
tryTake: () => {
|
|
486
|
+
if (out >= max) return false;
|
|
487
|
+
out += 1;
|
|
488
|
+
return true;
|
|
489
|
+
},
|
|
490
|
+
give: () => {
|
|
491
|
+
out = Math.max(0, out - 1);
|
|
492
|
+
},
|
|
493
|
+
outstanding: () => out,
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
const absurdFlushLoanBudget = createAbsurdFlushLoanBudget(
|
|
498
|
+
ABSURD_RUNTIME_WORKER_MAX_FLUSH_LOANS,
|
|
499
|
+
);
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Runs the pre-park lifecycle flush with the attempt's worker slot lent, and
|
|
503
|
+
* gets the slot back before returning, whether or not the flush throws. The
|
|
504
|
+
* flush only waits on the run-ledger outbox and the app (round 43377040223-1:
|
|
505
|
+
* detach -> park p50 1.2 s, p95 2.5 s, with the slot held), so the worker can
|
|
506
|
+
* claim another run meanwhile; the park that follows runs in a slot, as every
|
|
507
|
+
* step of the task does. Getting the slot back is in-memory in the engine and
|
|
508
|
+
* makes no scheduler-pool call, but it waits for a free slot, so the caller
|
|
509
|
+
* keeps the lease heartbeat running around this whole call. One
|
|
510
|
+
* `lifecycle_flush` phase line per flush reports the flush time, whether it
|
|
511
|
+
* was lent, and the wait for the slot.
|
|
512
|
+
*/
|
|
513
|
+
export async function runLifecycleFlushWithSlotLent<T>(input: {
|
|
514
|
+
workerSlot: PlayRunnerWorkerSlot | undefined;
|
|
515
|
+
budget?: ReturnType<typeof createAbsurdFlushLoanBudget>;
|
|
516
|
+
flush: () => Promise<T>;
|
|
517
|
+
log: (fields: {
|
|
518
|
+
totalMs: number;
|
|
519
|
+
lent: boolean;
|
|
520
|
+
slotWaitMs: number;
|
|
521
|
+
ok: boolean;
|
|
522
|
+
}) => void;
|
|
523
|
+
}): Promise<T> {
|
|
524
|
+
const budget = input.budget ?? absurdFlushLoanBudget;
|
|
525
|
+
let loan: { reclaim(): Promise<void> } | null = null;
|
|
526
|
+
if (input.workerSlot && budget.tryTake()) {
|
|
527
|
+
loan = input.workerSlot.lend();
|
|
528
|
+
if (!loan) budget.give();
|
|
529
|
+
}
|
|
530
|
+
const startedAt = performance.now();
|
|
531
|
+
let totalMs = 0;
|
|
532
|
+
let slotWaitMs = 0;
|
|
533
|
+
let ok = false;
|
|
534
|
+
try {
|
|
535
|
+
const result = await input.flush();
|
|
536
|
+
ok = true;
|
|
537
|
+
return result;
|
|
538
|
+
} finally {
|
|
539
|
+
totalMs = performance.now() - startedAt;
|
|
540
|
+
if (loan) {
|
|
541
|
+
const reclaimStartedAt = performance.now();
|
|
542
|
+
try {
|
|
543
|
+
await loan.reclaim();
|
|
544
|
+
} finally {
|
|
545
|
+
slotWaitMs = performance.now() - reclaimStartedAt;
|
|
546
|
+
budget.give();
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
input.log({ totalMs, lent: loan !== null, slotWaitMs, ok });
|
|
550
|
+
}
|
|
551
|
+
}
|
|
466
552
|
|
|
467
553
|
/**
|
|
468
554
|
* The engine's lendable slot for a play-run attempt. Undefined when the task
|
|
@@ -1086,51 +1172,93 @@ function buildDefaultDeps(absurd: Absurd): AbsurdRuntimeWorkerDeps {
|
|
|
1086
1172
|
* outage keeps the outbox row durable for recovery, but is always loud instead
|
|
1087
1173
|
* of silently leaving the CLI stale.
|
|
1088
1174
|
*/
|
|
1089
|
-
async function projectLifecycleOutbox(input: {
|
|
1175
|
+
export async function projectLifecycleOutbox(input: {
|
|
1090
1176
|
ctx: TaskContext;
|
|
1091
|
-
deps: AbsurdRuntimeWorkerDeps
|
|
1177
|
+
deps: Pick<AbsurdRuntimeWorkerDeps, 'projectOutbox'>;
|
|
1092
1178
|
launch: PlaySchedulerSubmitInput;
|
|
1093
1179
|
lifecycle: PostgresSchedulerLifecycleOutboxEvent;
|
|
1094
1180
|
options?: Pick<PostgresSchedulerOptions, 'schema'>;
|
|
1095
1181
|
transition: 'waiting' | 'resumed';
|
|
1096
1182
|
}): Promise<void> {
|
|
1183
|
+
// Before a park the flush only waits on the outbox and the app, so the slot
|
|
1184
|
+
// is lent for it (`runLifecycleFlushWithSlotLent`). Execution follows a
|
|
1185
|
+
// 'resumed' flush, which keeps its slot. The lease heartbeat runs until the
|
|
1186
|
+
// slot is back, as it does around a create loan: on a full worker, getting
|
|
1187
|
+
// the slot back can outlast the claim lease.
|
|
1097
1188
|
await runWithAbsurdExecutionLeaseHeartbeat({
|
|
1098
1189
|
ctx: input.ctx,
|
|
1099
1190
|
runId: input.lifecycle.runId,
|
|
1100
1191
|
operation: async (signal) => {
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
input.
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
// transient app-runtime failure, but do not hide the visibility gap.
|
|
1123
|
-
console.error('[run-ledger-outbox.lifecycle_projection_failed]', {
|
|
1124
|
-
runId: input.lifecycle.runId,
|
|
1125
|
-
eventId: input.lifecycle.eventId,
|
|
1126
|
-
transition: input.transition,
|
|
1127
|
-
error: error instanceof Error ? error.message : String(error),
|
|
1128
|
-
});
|
|
1129
|
-
}
|
|
1192
|
+
let delivered = false;
|
|
1193
|
+
await runLifecycleFlushWithSlotLent({
|
|
1194
|
+
workerSlot:
|
|
1195
|
+
input.transition === 'waiting'
|
|
1196
|
+
? absurdTaskWorkerSlot(input.ctx)
|
|
1197
|
+
: undefined,
|
|
1198
|
+
flush: async () => {
|
|
1199
|
+
delivered = await runLifecycleFlush(input, signal);
|
|
1200
|
+
},
|
|
1201
|
+
log: (fields) =>
|
|
1202
|
+
console.info(
|
|
1203
|
+
'[absurd-runtime.worker.phase] ' +
|
|
1204
|
+
JSON.stringify({
|
|
1205
|
+
runId: input.lifecycle.runId,
|
|
1206
|
+
phase: 'lifecycle_flush',
|
|
1207
|
+
transition: input.transition,
|
|
1208
|
+
...fields,
|
|
1209
|
+
delivered,
|
|
1210
|
+
}),
|
|
1211
|
+
),
|
|
1212
|
+
});
|
|
1130
1213
|
},
|
|
1131
1214
|
});
|
|
1132
1215
|
}
|
|
1133
1216
|
|
|
1217
|
+
/** True when the outbox delivered the lifecycle event to the app. */
|
|
1218
|
+
async function runLifecycleFlush(
|
|
1219
|
+
input: {
|
|
1220
|
+
deps: Pick<AbsurdRuntimeWorkerDeps, 'projectOutbox'>;
|
|
1221
|
+
launch: PlaySchedulerSubmitInput;
|
|
1222
|
+
lifecycle: PostgresSchedulerLifecycleOutboxEvent;
|
|
1223
|
+
options?: Pick<PostgresSchedulerOptions, 'schema'>;
|
|
1224
|
+
transition: 'waiting' | 'resumed';
|
|
1225
|
+
},
|
|
1226
|
+
signal: AbortSignal,
|
|
1227
|
+
): Promise<boolean> {
|
|
1228
|
+
try {
|
|
1229
|
+
const result = await input.deps.projectOutbox(
|
|
1230
|
+
input.launch,
|
|
1231
|
+
input.lifecycle.runId,
|
|
1232
|
+
input.options,
|
|
1233
|
+
input.lifecycle.eventId,
|
|
1234
|
+
signal,
|
|
1235
|
+
);
|
|
1236
|
+
if (result && !result.targetDelivered) {
|
|
1237
|
+
console.error('[run-ledger-outbox.lifecycle_projection_pending]', {
|
|
1238
|
+
runId: input.lifecycle.runId,
|
|
1239
|
+
eventId: input.lifecycle.eventId,
|
|
1240
|
+
transition: input.transition,
|
|
1241
|
+
projected: result.projected,
|
|
1242
|
+
failed: result.failed,
|
|
1243
|
+
failedEventIds: result.failedEventIds,
|
|
1244
|
+
});
|
|
1245
|
+
return false;
|
|
1246
|
+
}
|
|
1247
|
+
return true;
|
|
1248
|
+
} catch (error) {
|
|
1249
|
+
// Scheduler truth and the outbox row were committed atomically before this
|
|
1250
|
+
// handoff. Keep the durable continuation live so recovery can heal a
|
|
1251
|
+
// transient app-runtime failure, but do not hide the visibility gap.
|
|
1252
|
+
console.error('[run-ledger-outbox.lifecycle_projection_failed]', {
|
|
1253
|
+
runId: input.lifecycle.runId,
|
|
1254
|
+
eventId: input.lifecycle.eventId,
|
|
1255
|
+
transition: input.transition,
|
|
1256
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1257
|
+
});
|
|
1258
|
+
return false;
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1134
1262
|
function nonJsonResponseTitle(
|
|
1135
1263
|
value: string,
|
|
1136
1264
|
secrets: readonly string[],
|
|
@@ -5173,17 +5301,48 @@ async function executeAssignedAbsurdAttempt(input: {
|
|
|
5173
5301
|
.daytonaMaximumStartsPerMinute
|
|
5174
5302
|
: effectiveDaytonaStartRatePerMinute,
|
|
5175
5303
|
};
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
maximumRatePerMinute:
|
|
5184
|
-
daytonaStartRateConfig?.maximumRatePerMinute ?? null,
|
|
5185
|
-
}),
|
|
5304
|
+
// Measurement only: one line per attempt with its acquires
|
|
5305
|
+
// (each a scheduler-pool call) and local waits at the limiter.
|
|
5306
|
+
const permitStore = sandboxStartPermitStore({
|
|
5307
|
+
runWithClient: deps.runWithClient,
|
|
5308
|
+
schedulerSchema: options.schema ?? null,
|
|
5309
|
+
maximumRatePerMinute:
|
|
5310
|
+
daytonaStartRateConfig?.maximumRatePerMinute ?? null,
|
|
5186
5311
|
});
|
|
5312
|
+
const limiterStartedAt = performance.now();
|
|
5313
|
+
const limiterCounts = { acquires: 0, waits: 0, waitMs: 0 };
|
|
5314
|
+
let limiterOk = false;
|
|
5315
|
+
try {
|
|
5316
|
+
await enforceRuntimeTrafficPolicyBeforeSandboxStart({
|
|
5317
|
+
policy: trafficPolicy,
|
|
5318
|
+
defaultSandboxStartsPerMinute:
|
|
5319
|
+
defaultDaytonaStartRatePerMinute,
|
|
5320
|
+
nowMs: Date.now(),
|
|
5321
|
+
acquireStartPermit: (startsPerMinute) => {
|
|
5322
|
+
limiterCounts.acquires += 1;
|
|
5323
|
+
return permitStore.acquireStartPermit(startsPerMinute);
|
|
5324
|
+
},
|
|
5325
|
+
refundStartPermit: permitStore.refundStartPermit,
|
|
5326
|
+
sleep: async (ms) => {
|
|
5327
|
+
limiterCounts.waits += 1;
|
|
5328
|
+
limiterCounts.waitMs += ms;
|
|
5329
|
+
await sleep(ms);
|
|
5330
|
+
},
|
|
5331
|
+
});
|
|
5332
|
+
limiterOk = true;
|
|
5333
|
+
} finally {
|
|
5334
|
+
console.info(
|
|
5335
|
+
'[absurd-runtime.worker.phase] ' +
|
|
5336
|
+
JSON.stringify({
|
|
5337
|
+
runId,
|
|
5338
|
+
attempt: generation,
|
|
5339
|
+
phase: 'sandbox_start_limiter',
|
|
5340
|
+
totalMs: performance.now() - limiterStartedAt,
|
|
5341
|
+
ok: limiterOk,
|
|
5342
|
+
...limiterCounts,
|
|
5343
|
+
}),
|
|
5344
|
+
);
|
|
5345
|
+
}
|
|
5187
5346
|
}
|
|
5188
5347
|
const sandboxRuns = createSandboxExecutionJob({
|
|
5189
5348
|
execution: createPlayRunnerBackendSandboxExecutionAdapter({
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts
CHANGED
|
@@ -37,6 +37,10 @@ import type {
|
|
|
37
37
|
import type { PlaySchedulerSubmitInput } from '../scheduler-backend';
|
|
38
38
|
import type { DocflowObservationRecord } from '../docflow-observation';
|
|
39
39
|
import { runtimeWorkCountersFromStats } from '../runtime-work-counters';
|
|
40
|
+
import {
|
|
41
|
+
durableReplayRefusalFromRunLogLine,
|
|
42
|
+
emitPlayRunReplayRefusal,
|
|
43
|
+
} from '../runtime-telemetry';
|
|
40
44
|
import {
|
|
41
45
|
buildPlayRunLedgerEventsFromStatusPatch,
|
|
42
46
|
createEmptyPlayRunLedgerSnapshot,
|
|
@@ -764,6 +768,22 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
764
768
|
void flush({ force }).catch(() => undefined);
|
|
765
769
|
};
|
|
766
770
|
|
|
771
|
+
/** Re-emit runner replay refusals to this process's shipped log stream. */
|
|
772
|
+
const forwardReplayRefusal = (
|
|
773
|
+
line: string,
|
|
774
|
+
attempt: number | null | undefined = producerAttempt,
|
|
775
|
+
) => {
|
|
776
|
+
const refusal = durableReplayRefusalFromRunLogLine(line);
|
|
777
|
+
if (!refusal) return;
|
|
778
|
+
emitPlayRunReplayRefusal({
|
|
779
|
+
orgId: launch.orgId ?? null,
|
|
780
|
+
runId: launch.runId,
|
|
781
|
+
playName: launch.playName ?? null,
|
|
782
|
+
attempt: attempt ?? null,
|
|
783
|
+
refusal,
|
|
784
|
+
});
|
|
785
|
+
};
|
|
786
|
+
|
|
767
787
|
const appendLiveLog = (
|
|
768
788
|
line: string,
|
|
769
789
|
context?: unknown,
|
|
@@ -1469,6 +1489,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1469
1489
|
logEvent.entryId,
|
|
1470
1490
|
logEvent.metadata,
|
|
1471
1491
|
);
|
|
1492
|
+
forwardReplayRefusal(rawLine);
|
|
1472
1493
|
}
|
|
1473
1494
|
markMapStartedFromLog(rawLine);
|
|
1474
1495
|
markMapStartedFromPerfLog(rawLine);
|
|
@@ -1758,6 +1779,27 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1758
1779
|
reconcileTerminalMapProgressFromSheetOutcomes();
|
|
1759
1780
|
}
|
|
1760
1781
|
const status = options.status ?? 'running';
|
|
1782
|
+
const terminalReplayAttempt =
|
|
1783
|
+
options.terminalLogProducerAttempt ?? producerAttempt;
|
|
1784
|
+
const terminalLogReplay =
|
|
1785
|
+
options.skipTerminalLogReplay || !Array.isArray(result?.logs)
|
|
1786
|
+
? null
|
|
1787
|
+
: terminalReplayPayloadForMode({
|
|
1788
|
+
resultLogs: result.logs,
|
|
1789
|
+
resultLogContexts: result.logContexts,
|
|
1790
|
+
resultLogMetadata: result.logMetadata,
|
|
1791
|
+
resultLogIds: result.logIds,
|
|
1792
|
+
durableLogMode,
|
|
1793
|
+
liveLogs,
|
|
1794
|
+
liveLogContexts,
|
|
1795
|
+
liveLogsTotalCount,
|
|
1796
|
+
replayAllTerminalLogs: options.replayAllTerminalLogs === true,
|
|
1797
|
+
producerAttempt: terminalReplayAttempt,
|
|
1798
|
+
});
|
|
1799
|
+
// A detached runner that streamed no events delivers its refusals here.
|
|
1800
|
+
for (const line of terminalLogReplay?.lines ?? []) {
|
|
1801
|
+
forwardReplayRefusal(line, terminalReplayAttempt);
|
|
1802
|
+
}
|
|
1761
1803
|
await flush({
|
|
1762
1804
|
force: true,
|
|
1763
1805
|
status,
|
|
@@ -1767,22 +1809,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1767
1809
|
options.required === true ||
|
|
1768
1810
|
status === 'completed' ||
|
|
1769
1811
|
status === 'failed',
|
|
1770
|
-
terminalLogReplay
|
|
1771
|
-
options.skipTerminalLogReplay || !Array.isArray(result?.logs)
|
|
1772
|
-
? null
|
|
1773
|
-
: terminalReplayPayloadForMode({
|
|
1774
|
-
resultLogs: result.logs,
|
|
1775
|
-
resultLogContexts: result.logContexts,
|
|
1776
|
-
resultLogMetadata: result.logMetadata,
|
|
1777
|
-
resultLogIds: result.logIds,
|
|
1778
|
-
durableLogMode,
|
|
1779
|
-
liveLogs,
|
|
1780
|
-
liveLogContexts,
|
|
1781
|
-
liveLogsTotalCount,
|
|
1782
|
-
replayAllTerminalLogs: options.replayAllTerminalLogs === true,
|
|
1783
|
-
producerAttempt:
|
|
1784
|
-
options.terminalLogProducerAttempt ?? producerAttempt,
|
|
1785
|
-
}),
|
|
1812
|
+
terminalLogReplay,
|
|
1786
1813
|
});
|
|
1787
1814
|
};
|
|
1788
1815
|
|