From 26e7860347b1efb74a863ca90fad2ac9340a10f1 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 1 Dec 2025 18:01:54 -0500 Subject: Sort ready queue by priority getReadyTasks now returns tasks sorted by: 1. Priority (P0 first, then P1, P2, etc.) 2. Creation time (oldest first within same priority) This ensures high-priority items are always at the top of both the CLI 'jr task ready' output and the web dashboard. Task-Id: t-220 --- Omni/Task/Core.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Omni/Task/Core.hs') diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs index 8badf6b..0a1187f 100644 --- a/Omni/Task/Core.hs +++ b/Omni/Task/Core.hs @@ -810,7 +810,10 @@ getReadyTasks = do /= NeedsHelp && taskId task `notElem` needsInterventionIds - pure <| filter isReady openTasks + readyTasks = filter isReady openTasks + -- Sort by priority (P0 first) then by creation time (oldest first) + sorted = List.sortBy (comparing taskPriority <> comparing taskCreatedAt) readyTasks + pure sorted -- Get dependency tree getDependencyTree :: Text -> IO [Task] -- cgit v1.2.3