diff options
| author | Ben Sima <ben@bensima.com> | 2025-11-24 14:31:47 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-11-24 14:31:47 -0500 |
| commit | 34114e2016b186a52a7245fe3fb7e2bfe5091780 (patch) | |
| tree | 274588d3de0fbfb847151581e6d8945746c60012 | |
| parent | 1114ce3f55c1d9d90b49469a63accde094d8535f (diff) | |
Display credits correctly and don't loop agent
| -rw-r--r-- | .tasks/tasks.jsonl | 2 | ||||
| -rw-r--r-- | Omni/Agent/Log.hs | 2 | ||||
| -rw-r--r-- | Omni/Agent/Worker.hs | 14 |
3 files changed, 9 insertions, 9 deletions
diff --git a/.tasks/tasks.jsonl b/.tasks/tasks.jsonl index 8e5156f..7172ce0 100644 --- a/.tasks/tasks.jsonl +++ b/.tasks/tasks.jsonl @@ -221,3 +221,5 @@ {"taskCreatedAt":"2025-11-23T01:32:43.559862931Z","taskDependencies":[],"taskDescription":null,"taskId":"t-1o2cbqxw13j","taskNamespace":null,"taskParent":null,"taskPriority":"P2","taskStatus":"Done","taskTitle":"Build failed: pyproject.toml - ","taskType":"WorkTask","taskUpdatedAt":"2025-11-23T03:35:26.680640676Z"} {"taskCreatedAt":"2025-11-23T01:40:20.696284164Z","taskDependencies":[{"depId":"t-1o2cbco62ly","depType":"DiscoveredFrom"}],"taskDescription":null,"taskId":"t-1o2cbyi23kl","taskNamespace":null,"taskParent":null,"taskPriority":"P2","taskStatus":"Done","taskTitle":"Investigate why bild uses different source than workspace","taskType":"WorkTask","taskUpdatedAt":"2025-11-24T19:13:58.53979977Z"} {"taskCreatedAt":"2025-11-23T01:40:20.879380653Z","taskDependencies":[{"depId":"t-1o2cbco62ly","depType":"DiscoveredFrom"}],"taskDescription":null,"taskId":"t-1o2cbyi61hb","taskNamespace":null,"taskParent":null,"taskPriority":"P2","taskStatus":"Open","taskTitle":"Fix ruff formatting consistency in build environment","taskType":"WorkTask","taskUpdatedAt":"2025-11-23T01:40:20.879380653Z"} +{"taskCreatedAt":"2025-11-24T19:28:02.443317007Z","taskDependencies":[],"taskDescription":null,"taskId":"t-1o2efbs6lst","taskNamespace":"Omni/Agent.hs","taskParent":null,"taskPriority":"P2","taskStatus":"Done","taskTitle":"Remove looping logic from agent worker","taskType":"WorkTask","taskUpdatedAt":"2025-11-24T19:28:40.993778347Z"} +{"taskCreatedAt":"2025-11-24T19:28:07.348886747Z","taskDependencies":[],"taskDescription":"The agent credit usage is displayed as dollars when they should be displayed as cents. For example: it currently displays $50 when it should show $0.50","taskId":"t-1o2efbv3t8o","taskNamespace":"Omni/Agent.hs","taskParent":null,"taskPriority":"P2","taskStatus":"Done","taskTitle":"Fix agent credit usage display (show as dollars)","taskType":"WorkTask","taskUpdatedAt":"2025-11-24T19:29:46.525888911Z"} diff --git a/Omni/Agent/Log.hs b/Omni/Agent/Log.hs index 71a7aca..2942563 100644 --- a/Omni/Agent/Log.hs +++ b/Omni/Agent/Log.hs @@ -166,7 +166,7 @@ updateFromEntry :: LogEntry -> Status -> Status updateFromEntry LogEntry {..} s = s { statusThread = leThreadId <|> statusThread s, - statusCredits = fromMaybe (statusCredits s) (leTotalCredits <|> leCredits), + statusCredits = maybe (statusCredits s) (/ 100.0) (leTotalCredits <|> leCredits), statusTime = maybe (statusTime s) formatTime leTimestamp } diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs index 7266162..c9a7563 100644 --- a/Omni/Agent/Worker.hs +++ b/Omni/Agent/Worker.hs @@ -19,11 +19,11 @@ import qualified System.Process as Process start :: Core.Worker -> IO () start worker = do AgentLog.init (Core.workerName worker) - AgentLog.log ("Worker starting loop for " <> Core.workerName worker) - loop worker + AgentLog.log ("Worker starting for " <> Core.workerName worker) + runOnce worker -loop :: Core.Worker -> IO () -loop worker = do +runOnce :: Core.Worker -> IO () +runOnce worker = do let repo = Core.workerPath worker AgentLog.updateActivity "Syncing tasks..." @@ -43,12 +43,10 @@ loop worker = do readyTasks <- TaskCore.getReadyTasks case readyTasks of [] -> do - AgentLog.updateActivity "No work found, sleeping..." - threadDelay (60 * 1000000) -- 60 seconds - loop worker + AgentLog.updateActivity "No work found." + AgentLog.log "No ready tasks found." (task : _) -> do processTask worker task - loop worker processTask :: Core.Worker -> TaskCore.Task -> IO () processTask worker task = do |
