Skip to content

Commit 8252b67

Browse files
committed
fix(executor): filter codex_core stderr noise
1 parent 207d3c5 commit 8252b67

2 files changed

Lines changed: 33 additions & 2 deletions

File tree

codeagent-wrapper/internal/executor/filter.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ var geminiNoisePatterns = []string{
2020

2121
// codexNoisePatterns contains stderr patterns to filter for codex backend
2222
var codexNoisePatterns = []string{
23-
"ERROR codex_core::codex: needs_follow_up:",
24-
"ERROR codex_core::skills::loader:",
23+
"ERROR codex_core::",
2524
}
2625

2726
// filteringWriter wraps an io.Writer and filters out lines matching patterns

codeagent-wrapper/internal/executor/filter_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,35 @@ func TestFilteringWriterPartialLines(t *testing.T) {
7171
t.Errorf("got %q, want %q", got, "Hello World\n")
7272
}
7373
}
74+
75+
func TestFilteringWriterCodexNoise(t *testing.T) {
76+
tests := []struct {
77+
name string
78+
input string
79+
want string
80+
}{
81+
{
82+
name: "filter all codex_core errors",
83+
input: "ERROR codex_core::rollout::list: state db missing rollout path for thread 123\nERROR codex_core::skills::loader: missing skill\nVisible output\n",
84+
want: "Visible output\n",
85+
},
86+
{
87+
name: "keep non codex_core errors",
88+
input: "ERROR another_module::state: real failure\nERROR codex_core::codex: needs_follow_up: true\nDone\n",
89+
want: "ERROR another_module::state: real failure\nDone\n",
90+
},
91+
}
92+
93+
for _, tt := range tests {
94+
t.Run(tt.name, func(t *testing.T) {
95+
var buf bytes.Buffer
96+
fw := newFilteringWriter(&buf, codexNoisePatterns)
97+
_, _ = fw.Write([]byte(tt.input))
98+
fw.Flush()
99+
100+
if got := buf.String(); got != tt.want {
101+
t.Errorf("got %q, want %q", got, tt.want)
102+
}
103+
})
104+
}
105+
}

0 commit comments

Comments
 (0)