diff --git a/src/browser/PlaywrightElectronActiveActions.ts b/src/browser/PlaywrightElectronActiveActions.ts index 0376935610..d06657e86b 100644 --- a/src/browser/PlaywrightElectronActiveActions.ts +++ b/src/browser/PlaywrightElectronActiveActions.ts @@ -151,14 +151,17 @@ export const runElectronActions = async ( stoppedBy = options.signal?.aborted ? "cancelled" : "failed"; actionError = safeActionErrorMessage(cause); } + const outcome = + actionError === null + ? { status: "completed" as const, error: null } + : { status: stoppedBy ?? "failed", error: actionError }; actions.push({ step_id: action.step_id, kind: action.kind, window_index: windowIndex, target, - status: stoppedBy ?? "completed", + ...outcome, elapsed_ms: Math.max(0, Math.round(performance.now() - actionStartedAt)), - error: actionError, }); if (handleOwner !== undefined) { cleanupError = await releaseActionWindow( diff --git a/src/process/capture/ProcessCaptureObservation.test.ts b/src/process/capture/ProcessCaptureObservation.test.ts index de071301b0..81deb057e1 100644 --- a/src/process/capture/ProcessCaptureObservation.test.ts +++ b/src/process/capture/ProcessCaptureObservation.test.ts @@ -74,7 +74,7 @@ it("returns detached terminal observations", async () => { const utf8Bytes = Buffer.byteLength(value); return utf8Bytes <= maxBytes ? { state: "normalized", value, utf8Bytes } - : { state: "over_budget" }; + : { state: "over_budget", reason: "retention" }; }, recordEvent: (collection, index) => observed.push(`${collection}:${String(index)}`),