Preserve all fetched search sources before transport truncation

This commit is contained in:
pewdiepie-archdaemon
2026-09-17 22:00:44 +00:00
parent 31f9e11c0f
commit 144c8a3dd6
4 changed files with 55 additions and 31 deletions
+4
View File
@@ -304,6 +304,10 @@ class WebSearchTool:
"elapsed_s": 30,
"tail": "Search completed; preparing sources.",
})
# Compact the complete report before the transport cap. Otherwise
# repeated summaries from early sources permanently erase later pages.
from src.search_passages import bounded_search_observation
text = bounded_search_observation(text, MAX_OUTPUT_CHARS)
output = text[:MAX_OUTPUT_CHARS] if len(text) > MAX_OUTPUT_CHARS else text
if sources:
output += "\n\n<!-- SOURCES:" + json.dumps(sources) + " -->"