From d78cdd7119cc17c9d268501adbc5e5da2f5c1a72 Mon Sep 17 00:00:00 2001 From: JonthanaHanh <92574114+JonthanaHanh@users.noreply.github.com> Date: Sat, 5 Sep 2026 18:36:24 +0530 Subject: [PATCH] fix(tools): truncation footers name the path the SANDBOX sees, not the host path (#72389, #81984, #77015) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tools/browser_tool_snapshot.py | 4 ++++ tools/delegate_tool_results.py | 4 ++++ tools/web_tools_truncate.py | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/tools/browser_tool_snapshot.py b/tools/browser_tool_snapshot.py index f502441229..c35a512382 100644 --- a/tools/browser_tool_snapshot.py +++ b/tools/browser_tool_snapshot.py @@ -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] = [] diff --git a/tools/delegate_tool_results.py b/tools/delegate_tool_results.py index c3b08a58be..3d655d4b50 100644 --- a/tools/delegate_tool_results.py +++ b/tools/delegate_tool_results.py @@ -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) " diff --git a/tools/web_tools_truncate.py b/tools/web_tools_truncate.py index 4570eb2f7f..1cee30e81f 100644 --- a/tools/web_tools_truncate.py +++ b/tools/web_tools_truncate.py @@ -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) "