Skip to content

Commit c5c985e

Browse files
committed
fix(server): recovery reads unfinished runs as the latest, matching runRanAfter
1 parent a244b88 commit c5c985e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎apps/server/src/orchestration-v2/ProjectionStore.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3817,6 +3817,8 @@ export const layer: Layer.Layer<ProjectionStoreV2, never, SqlClient.SqlClient> =
38173817
WHERE ended.thread_id = ${threadId}
38183818
AND ended.status != 'queued'
38193819
ORDER BY
3820+
CASE WHEN json_valid(ended.payload_json)
3821+
THEN json_extract(ended.payload_json, '$.completedAt') END IS NULL DESC,
38203822
CASE WHEN json_valid(ended.payload_json)
38213823
THEN json_extract(ended.payload_json, '$.completedAt') END DESC,
38223824
ended.ordinal DESC

0 commit comments

Comments
 (0)