File tree Expand file tree Collapse file tree
apps/server/src/scheduledTasks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2330,13 +2330,9 @@ export const layer = Layer.effect(
23302330 yield * remove ;
23312331 continue ;
23322332 }
2333- // A running row was already sent, so recovery keeps the prompt it was sent with.
2334- // A failed load falls back to the snapshot and runTask fails the delivery.
2335- const current =
2336- entry . state === "dispatching"
2337- ? yield * findTask ( taskId ) . pipe ( Effect . orElseSucceed ( ( ) => null ) )
2338- : null ;
23392333 const prepared = yield * Effect . gen ( function * ( ) {
2334+ // A running row was already sent, so recovery keeps the prompt it was sent with.
2335+ const current = entry . state === "dispatching" ? yield * findTask ( taskId ) : null ;
23402336 const snapshot = yield * decodePendingTask ( entry . task_json ) ;
23412337 // The snapshot keeps the identity runTask checks; the prompt is the one saved now.
23422338 const task =
Original file line number Diff line number Diff line change @@ -1121,8 +1121,11 @@ it.effect("a coalesced window fails its delivery when the task row cannot be rea
11211121 assert . equal ( ( yield * sql `SELECT 1 FROM scheduled_task_webhook_pending` ) . length , 0 ) ;
11221122 const [ delivery ] = yield * sql < {
11231123 outcome : string ;
1124- } > `SELECT outcome FROM scheduled_task_webhook_deliveries` ;
1124+ error : string | null ;
1125+ } > `SELECT outcome, error FROM scheduled_task_webhook_deliveries` ;
11251126 assert . equal ( delivery ?. outcome , "dispatch_failed" ) ;
1127+ // Failing before dispatch means a later successful read cannot send the stale snapshot.
1128+ assert . equal ( delivery ?. error , "The pending webhook payload could not be prepared." ) ;
11261129 } ) ,
11271130 { workers } ,
11281131 ) ;
You can’t perform that action at this time.
0 commit comments