TypeScript
fix(client): keep snoozed failures hidden without completion times (#30063)
Lakshmi Tanmaydd8c122c5d52
diff --git a/packages/client-runtime/src/state/threadSettled.ts b/packages/client-runtime/src/state/threadSettled.tsindex 6ad788e0a66..fa1c33fb834 100644--- a/packages/client-runtime/src/state/threadSettled.ts+++ b/packages/client-runtime/src/state/threadSettled.ts@@ -96,14 +96,14 @@ export function threadRaisedHandWhileSnoozed(shell: ThreadSnoozeShell): boolean);}-// V2 runtime.updatedAt includes metadata writes; prefer the failed run's completion.+// V2 runtime.updatedAt includes metadata writes, not just failures.// Legacy sessions only expose the runtime timestamp.function failureEdgeAt(shell: ThreadSnoozeShell): string | null | undefined {const runtime = shell.runtime ?? shell.session ?? null;if (runtime?.status !== "error" && runtime?.status !== "failed") return undefined;const latestRun = shell.latestRun ?? shell.latestTurn ?? null;- if (latestRun?.status === "failed" && latestRun.completedAt != null) {- return latestRun.completedAt;+ if (latestRun?.status === "failed") {+ return latestRun.completedAt ?? null;}return runtime.updatedAt ?? null;}diff --git a/packages/client-runtime/src/state/threadSnoozed.test.ts b/packages/client-runtime/src/state/threadSnoozed.test.tsindex adf9227bf01..f8f01ec6a1d 100644--- a/packages/client-runtime/src/state/threadSnoozed.test.ts+++ b/packages/client-runtime/src/state/threadSnoozed.test.ts@@ -96,6 +96,18 @@ describe("effectiveSnoozed", () => {pending: undefined,wokeAt: null,},+ {+ reason: "failure without a completion timestamp",+ completedAt: null,+ pending: undefined,+ wokeAt: null,+ },+ {+ reason: "approval without a failure completion timestamp",+ completedAt: null,+ pending: "approval",+ wokeAt: "2026-04-10T11:00:00.000Z",+ },{reason: "fresh failure",completedAt: "2026-04-10T10:00:00.000Z",