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) "