diff --git a/CHANGELOG.md b/CHANGELOG.md index d9f2dec..bcf4a00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project are documented in this file. The format is b ### Fixed +- **LLM connection-test logs stay one line**: the response body written by a connection test has CR and LF replaced with spaces before it is logged, so the body cannot start a second log record. - **Benchmark judge validation**: grading and the judge's falsification battery require one verdict per ground-truth ID, actual boolean decisions and gates, and matches to the supplied scanner findings. Invalid grading responses use the existing three-attempt budget and abort without writing scores, rather than counting duplicate IDs or truthy strings such as `"false"`. - **Live log subscribers can no longer crash the process**: a client disconnect closes its log channel. The sink now delivers a line while it still holds the subscriber lock, so that close cannot land in the middle of the send. - **Notification delivery ignores HTTP_PROXY**: the dial guard checks the address it connects to. An environment proxy made that address the proxy, so a link-local target could still be reached. Notification HTTP now connects directly. diff --git a/agent/clipbody_test.go b/agent/clipbody_test.go new file mode 100644 index 0000000..21194ba --- /dev/null +++ b/agent/clipbody_test.go @@ -0,0 +1,16 @@ +package agent + +import ( + "strings" + "testing" +) + +func TestClipBodyFlattensNewlines(t *testing.T) { + got := clipBody("ok\r\ninjected log line\n") + if strings.Contains(got, "\n") || strings.Contains(got, "\r") { + t.Fatalf("clipBody kept a line break: %q", got) + } + if !strings.Contains(got, "injected log line") { + t.Fatalf("clipBody dropped the text: %q", got) + } +} diff --git a/agent/provider.go b/agent/provider.go index 96d39a6..088fcbb 100644 --- a/agent/provider.go +++ b/agent/provider.go @@ -602,6 +602,11 @@ func logTestConnection(c Config, capt *llmrec.Capture) { // the head of an SSE stream while bounding a runaway response. func clipBody(s string) string { s = strings.TrimSpace(s) + // One log record per attempt. A body that contains a newline would + // otherwise look like a second log line. + s = strings.ReplaceAll(s, "\r\n", " ") + s = strings.ReplaceAll(s, "\n", " ") + s = strings.ReplaceAll(s, "\r", " ") if s == "" { return "(empty)" }