From 8252b67567fbff53d63a9c9f5eb33127be6cf9f5 Mon Sep 17 00:00:00 2001 From: cexll Date: Wed, 18 Feb 2026 16:32:59 +0800 Subject: [PATCH] fix(executor): filter codex_core stderr noise --- codeagent-wrapper/internal/executor/filter.go | 3 +- .../internal/executor/filter_test.go | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/codeagent-wrapper/internal/executor/filter.go b/codeagent-wrapper/internal/executor/filter.go index fbcbf08..9be2945 100644 --- a/codeagent-wrapper/internal/executor/filter.go +++ b/codeagent-wrapper/internal/executor/filter.go @@ -20,8 +20,7 @@ var geminiNoisePatterns = []string{ // codexNoisePatterns contains stderr patterns to filter for codex backend var codexNoisePatterns = []string{ - "ERROR codex_core::codex: needs_follow_up:", - "ERROR codex_core::skills::loader:", + "ERROR codex_core::", } // filteringWriter wraps an io.Writer and filters out lines matching patterns diff --git a/codeagent-wrapper/internal/executor/filter_test.go b/codeagent-wrapper/internal/executor/filter_test.go index 55d2949..af8e9b6 100644 --- a/codeagent-wrapper/internal/executor/filter_test.go +++ b/codeagent-wrapper/internal/executor/filter_test.go @@ -71,3 +71,35 @@ func TestFilteringWriterPartialLines(t *testing.T) { t.Errorf("got %q, want %q", got, "Hello World\n") } } + +func TestFilteringWriterCodexNoise(t *testing.T) { + tests := []struct { + name string + input string + want string + }{ + { + name: "filter all codex_core errors", + input: "ERROR codex_core::rollout::list: state db missing rollout path for thread 123\nERROR codex_core::skills::loader: missing skill\nVisible output\n", + want: "Visible output\n", + }, + { + name: "keep non codex_core errors", + input: "ERROR another_module::state: real failure\nERROR codex_core::codex: needs_follow_up: true\nDone\n", + want: "ERROR another_module::state: real failure\nDone\n", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + var buf bytes.Buffer + fw := newFilteringWriter(&buf, codexNoisePatterns) + _, _ = fw.Write([]byte(tt.input)) + fw.Flush() + + if got := buf.String(); got != tt.want { + t.Errorf("got %q, want %q", got, tt.want) + } + }) + } +}