From 644781efd6ed705eeb6f1048ed9b07769aa85d63 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 23 Dec 2025 07:48:32 -0500 Subject: Omni/Ci: improve error message extraction in git notes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add extractErrorMessage function to filter meaningful errors - Extract only lines containing fail/error keywords - Filter out progress output and warnings - Limit to first 5 error lines for concise reporting - Fixes issue with unhelpful progress output in CI notes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- Omni/Ci.hs | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Omni/Ci.hs b/Omni/Ci.hs index bedeab7..04dba06 100755 --- a/Omni/Ci.hs +++ b/Omni/Ci.hs @@ -134,7 +134,7 @@ move args = do (exitCodeLint, _, lintStderr) <- Process.readProcessWithExitCode runlint [] "" pure <| case exitCodeLint of Exit.ExitSuccess -> ("good", "") - _ -> ("fail", Text.pack lintStderr) + _ -> ("fail", extractErrorMessage (Text.pack lintStderr)) -- 6. Run Tests -- if bild "${BILD_ARGS:-""}" --test "${CODEROOT:?}"/**/* @@ -149,7 +149,7 @@ move args = do (exitCodeTest, _, testStderr) <- Process.readProcessWithExitCode "bild" ("--test" : allFiles) "" pure <| case exitCodeTest of Exit.ExitSuccess -> ("good", "") - _ -> ("fail", Text.pack testStderr) + _ -> ("fail", extractErrorMessage (Text.pack testStderr)) -- 7. Create Note let noteMsg = case (fst lintResult, fst testResult) of @@ -203,3 +203,30 @@ getCoderoot = do case mEnvRoot of Just envRoot -> pure envRoot Nothing -> panic "CODEROOT not set" -- Simplified for now + +-- | Extract meaningful error messages from tool output, filtering out progress/status lines +extractErrorMessage :: Text -> Text +extractErrorMessage output = + let errorLines = + Text.lines output + |> filter isErrorLine + |> take 5 -- Limit to first 5 error lines + cleaned = + if null errorLines + then ["Unknown error (no error lines found)"] + else errorLines + in Text.unlines cleaned + where + isErrorLine line = + let stripped = Text.strip line + in not (Text.null stripped) + && ( "fail:" + `Text.isInfixOf` stripped + || "error:" + `Text.isInfixOf` stripped + || "Error:" + `Text.isInfixOf` stripped + || "ERROR:" + `Text.isInfixOf` stripped + ) + && not ("warning:" `Text.isInfixOf` stripped) -- Exclude warnings -- cgit v1.2.3