fix(tools): truncation footers name the path the SANDBOX sees, not the host path (#72389, #81984, #77015)

web_extract / browser_snapshot / delegate_task spill their full text under HERMES_HOME/cache,
which is mounted read-only into docker/modal (at /root/.hermes) and synced under ~/.hermes for
ssh/daytona/vercel — but the footer told the agent the HOST path, so read_file inside the
sandbox got 'File not found'. Translate through the existing
credential_files.to_agent_visible_cache_path (what tool_result_storage already does); local and
singularity are unchanged.

Salvaged from #72429 by @JonthanaHanh (the web_extract sites), widened to every footer.
This commit is contained in:
JonthanaHanh
2026-09-05 18:36:24 +05:30
committed by kshitij
parent 2a93bdaeba
commit d78cdd7119
3 changed files with 13 additions and 0 deletions
+4
View File
@@ -79,6 +79,10 @@ def _truncate_snapshot(snapshot_text: str, max_chars: Optional[int] = None) -> s
return snapshot_text
stored_path = _store_full_snapshot(snapshot_text)
if stored_path:
# Agent-visible path: read_file runs inside the active backend (#72389).
from tools.credential_files import to_agent_visible_cache_path
stored_path = to_agent_visible_cache_path(stored_path)
lines = snapshot_text.split('\n')
result: list[str] = []
+4
View File
@@ -200,6 +200,10 @@ def _trim_summary_with_footer(summary: str, cap: int, task_index: int) -> tuple[
tail = tail[nl + 1:]
spill_path = _spill_summary_to_file(task_index, summary)
if spill_path:
# Agent-visible path: the parent's read_file runs inside the active backend (#81984, #77015).
from tools.credential_files import to_agent_visible_cache_path
spill_path = to_agent_visible_cache_path(spill_path)
footer_lines = [
"", "─" * 8 + " [SUMMARY TRUNCATED] " + "─" * 8,
f"Showing {len(head):,} chars (head) + {len(tail):,} chars (tail) "
+5
View File
@@ -99,6 +99,11 @@ def _truncate_with_footer(content: str, url: str, char_limit: int) -> tuple[str,
tail = tail[nl + 1:]
stored_path = _store_full_text(url, content)
if stored_path:
# The footer is read by the AGENT, whose read_file runs inside the active backend: render the
# path where docker/modal/ssh/... see the mounted cache, not the host path (#72389, #81984).
from tools.credential_files import to_agent_visible_cache_path
stored_path = to_agent_visible_cache_path(stored_path)
footer_lines = [
"", "─" * 8 + " [TRUNCATED] " + "─" * 8,
f"Showing {len(head):,} chars (head) + {len(tail):,} chars (tail) "