Stop base64 encoding LLM responses in debug output
This commit is contained in:
@@ -3700,7 +3700,8 @@ func assertDistinctRoots(t *testing.T, roots ...string) {
|
||||
}
|
||||
}
|
||||
|
||||
var debugBase64FieldPattern = regexp.MustCompile(`"(?:content_base64|content)"\s*:\s*"([^"]*)"`)
|
||||
var debugBase64FieldPattern = regexp.MustCompile(`"content_base64"\s*:\s*"([^"]*)"`)
|
||||
var debugRawLLMResponseContentPattern = regexp.MustCompile(`"content"\s*:\s*"(?:\\.|[^"\\])*"`)
|
||||
|
||||
func assertDebugTreeDoesNotContain(t *testing.T, root string, forbidden ...string) {
|
||||
t.Helper()
|
||||
@@ -3715,7 +3716,7 @@ func assertDebugTreeDoesNotContain(t *testing.T, root string, forbidden ...strin
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
text := string(data)
|
||||
text := debugRawLLMResponseContentPattern.ReplaceAllString(string(data), `"content":"[RAW_LLM_RESPONSE]"`)
|
||||
for _, value := range forbidden {
|
||||
if strings.Contains(text, value) {
|
||||
t.Fatalf("debug artifact %q contains forbidden value %q", path, value)
|
||||
|
||||
Reference in New Issue
Block a user