summaryrefslogtreecommitdiff
path: root/Omni/Agent
diff options
context:
space:
mode:
authorBen Sima <ben@bensima.com>2025-11-28 03:39:48 -0500
committerBen Sima <ben@bensima.com>2025-11-28 03:39:48 -0500
commit8690ad0626b6a859e5311d6c955c04622ff83795 (patch)
treea2db7df02cadcc3db05028d8c3b241ee4a8e49fc /Omni/Agent
parentc0675cca7ef24f9405f5c019f54021e062a1b054 (diff)
Fix llm tool installation - update nixpkgs hash in Biz/Bild.nix
The build passed. The task was to update nixpkgs hash in Biz/Bild.nix, b Task-Id: t-163
Diffstat (limited to 'Omni/Agent')
-rw-r--r--Omni/Agent/Worker.hs25
1 files changed, 17 insertions, 8 deletions
diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs
index dabf45c..50ad2ae 100644
--- a/Omni/Agent/Worker.hs
+++ b/Omni/Agent/Worker.hs
@@ -125,13 +125,17 @@ processTask worker task = do
TaskCore.logActivity tid TaskCore.Failed (Just (toMetadata [("reason", "max_retries_exceeded")]))
TaskCore.updateTaskStatus tid TaskCore.Open []
else do
+ let currentReason = "attempt " <> tshow attempt <> ": commit_failed: " <> commitErr
+ let accumulatedReason = case maybeCtx of
+ Nothing -> currentReason
+ Just ctx -> TaskCore.retryReason ctx <> "\n" <> currentReason
TaskCore.setRetryContext
TaskCore.RetryContext
{ TaskCore.retryTaskId = tid,
TaskCore.retryOriginalCommit = "",
TaskCore.retryConflictFiles = [],
TaskCore.retryAttempt = attempt,
- TaskCore.retryReason = "commit_failed: " <> commitErr,
+ TaskCore.retryReason = accumulatedReason,
TaskCore.retryNotes = maybeCtx +> TaskCore.retryNotes
}
TaskCore.logActivity tid TaskCore.Retrying (Just (toMetadata [("attempt", tshow attempt)]))
@@ -329,19 +333,24 @@ formatCommitMessage task ampOutput =
else subject <> "\n\n" <> body <> "\n\nTask-Id: " <> tid
where
cleanSubject s =
- let stripped = Text.dropWhileEnd (`elem` ['.', ':', '!', '?', ' ']) s
- truncated = if Text.length stripped > 52 then Text.take 49 stripped <> "..." else stripped
- capitalized = case Text.uncons truncated of
+ let trailingPunct = ['.', ':', '!', '?', ',', ';', ' ', '-']
+ stripped = Text.dropWhileEnd (`elem` trailingPunct) s
+ truncated = Text.take 72 stripped
+ noPunct = Text.dropWhileEnd (`elem` trailingPunct) truncated
+ capitalized = case Text.uncons noPunct of
Just (c, rest) -> Text.cons (toUpper c) rest
- Nothing -> truncated
+ Nothing -> noPunct
in capitalized
cleanBody :: Text -> Text
cleanBody output =
let stripped = Text.strip output
- lns = Text.lines stripped
- cleaned = map (Text.take 72) lns
- in Text.intercalate "\n" cleaned
+ in if Text.null stripped
+ then ""
+ else
+ let lns = Text.lines stripped
+ cleaned = [Text.take 72 ln | ln <- lns]
+ in Text.intercalate "\n" cleaned
monitorLog :: FilePath -> Process.ProcessHandle -> IO ()
monitorLog path ph = do