Merge pull request #493 from Coff0xc/fix/llm-test-log-line

fix(agent): keep LLM connection-test logs on one line
This commit is contained in:
BaaRai
2026-11-22 23:01:25 +01:00
committed by GitHub
3 changed files with 22 additions and 0 deletions
+1
View File
@@ -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.
+16
View File
@@ -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)
}
}
+5
View File
@@ -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)"
}