fix(executor): filter codex_core stderr noise

This commit is contained in:
cexll
2026-02-18 16:32:59 +08:00
parent 207d3c5436
commit 4f4e0d65f6
2 changed files with 33 additions and 2 deletions

View File

@@ -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

View File

@@ -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)
}
})
}
}