Merge pull request #3141 from jincheng-xydt/fix/3125-brave-search-logging

fix(web_search): add diagnostic logging for Brave empty results
This commit is contained in:
Mauro
2026-06-18 08:16:14 +02:00
committed by GitHub
+13
View File
@@ -350,6 +350,19 @@ func (p *BraveSearchProvider) Search(
results := searchResp.Web.Results
if len(results) == 0 {
// Log a warning when the API returned 200 but no results.
// This helps diagnose API format changes or silent errors
// where the response body does not match the expected structure.
bodyPreview := string(body)
if len(bodyPreview) > 300 {
bodyPreview = bodyPreview[:300]
}
logger.WarnCF("web_search", "Brave API returned empty results",
map[string]any{
"query": query,
"status": resp.StatusCode,
"body_preview": bodyPreview,
})
return fmt.Sprintf("No results for: %s", query), nil
}