commit 26e7860347b1efb74a863ca90fad2ac9340a10f1
Author: Ben Sima <ben@bensima.com>
Date: Mon Dec 1 18:01:54 2025
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
diff --git a/Omni/Task/Core.hs b/Omni/Task/Core.hs
index 8badf6be..0a1187f4 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]