File tree Expand file tree Collapse file tree
packages/client-runtime/src/state Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,14 +96,14 @@ export function threadRaisedHandWhileSnoozed(shell: ThreadSnoozeShell): boolean
9696 ) ;
9797}
9898
99- // V2 runtime.updatedAt includes metadata writes; prefer the failed run's completion .
99+ // V2 runtime.updatedAt includes metadata writes, not just failures .
100100// Legacy sessions only expose the runtime timestamp.
101101function failureEdgeAt ( shell : ThreadSnoozeShell ) : string | null | undefined {
102102 const runtime = shell . runtime ?? shell . session ?? null ;
103103 if ( runtime ?. status !== "error" && runtime ?. status !== "failed" ) return undefined ;
104104 const latestRun = shell . latestRun ?? shell . latestTurn ?? null ;
105- if ( latestRun ?. status === "failed" && latestRun . completedAt != null ) {
106- return latestRun . completedAt ;
105+ if ( latestRun ?. status === "failed" ) {
106+ return latestRun . completedAt ?? null ;
107107 }
108108 return runtime . updatedAt ?? null ;
109109}
Original file line number Diff line number Diff line change @@ -96,6 +96,18 @@ describe("effectiveSnoozed", () => {
9696 pending : undefined ,
9797 wokeAt : null ,
9898 } ,
99+ {
100+ reason : "failure without a completion timestamp" ,
101+ completedAt : null ,
102+ pending : undefined ,
103+ wokeAt : null ,
104+ } ,
105+ {
106+ reason : "approval without a failure completion timestamp" ,
107+ completedAt : null ,
108+ pending : "approval" ,
109+ wokeAt : "2026-04-10T11:00:00.000Z" ,
110+ } ,
99111 {
100112 reason : "fresh failure" ,
101113 completedAt : "2026-04-10T10:00:00.000Z" ,
You can’t perform that action at this time.
0 commit comments