← Back to task

Commit 24176261

commit 24176261ab893e9441ea9e4c3e0ead8a59b8c50e
Author: Ben Sima <ben@bensima.com>
Date:   Wed Nov 26 06:00:58 2025

    Clean commit message subject for gitlint compliance
    
    - Remove trailing punctuation from subject line - Truncate to 72
    chars max - Capitalize first letter
    
    Task-Id: t-1o2g8gugkr1

diff --git a/Omni/Agent/Worker.hs b/Omni/Agent/Worker.hs
index 0c15a572..c5ee451d 100644
--- a/Omni/Agent/Worker.hs
+++ b/Omni/Agent/Worker.hs
@@ -269,12 +269,24 @@ formatCommitMessage :: Text -> Text -> Text
 formatCommitMessage ampOutput taskId =
   case Text.lines (Text.strip ampOutput) of
     [] -> "Task completed\n\nTask-Id: " <> taskId
-    [subject] -> subject <> "\n\nTask-Id: " <> taskId
+    [subject] -> cleanSubject subject <> "\n\nTask-Id: " <> taskId
     (subject : rest) ->
       let body = Text.strip (Text.unlines (dropWhile Text.null rest))
        in if Text.null body
-            then subject <> "\n\nTask-Id: " <> taskId
-            else subject <> "\n\n" <> body <> "\n\nTask-Id: " <> taskId
+            then cleanSubject subject <> "\n\nTask-Id: " <> taskId
+            else cleanSubject subject <> "\n\n" <> body <> "\n\nTask-Id: " <> taskId
+  where
+    -- Clean subject line for gitlint compliance:
+    -- - Remove trailing punctuation (.:!?)
+    -- - Truncate to 72 chars
+    -- - Capitalize first letter
+    cleanSubject s =
+      let stripped = Text.dropWhileEnd (`elem` ['.', ':', '!', '?', ' ']) s
+          truncated = if Text.length stripped > 72 then Text.take 69 stripped <> "..." else stripped
+          capitalized = case Text.uncons truncated of
+            Just (c, rest) -> Text.cons (toUpper c) rest
+            Nothing -> truncated
+       in capitalized
 
 monitorLog :: FilePath -> Process.ProcessHandle -> IO ()
 monitorLog path ph = do