From 0d4dbde837e521b55846436b1a74ed1ef401f0e2 Mon Sep 17 00:00:00 2001 From: Halldrix <12357213+Halldrix@users.noreply.github.com> Date: Sun, 27 Sep 2026 12:11:57 +0530 Subject: [PATCH] fix(delegate): mark elided timeout-diagnostic goal and eval tool output The subagent timeout diagnostic and the session_search eval harness still appended a bare "...[truncated]" marker, the imitable wording #121548 replaced everywhere else. Route both through agent.compression_marker.elide so every elision in the tree mints the same counted, guard-matched marker. Salvaged from #122392 (only the two call-site hunks; base already ships the elide helpers the PR re-defined). Refs #121572. --- evals/session_search_schema/runner.py | 3 ++- tools/delegate_tool_child_run.py | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/evals/session_search_schema/runner.py b/evals/session_search_schema/runner.py index 20516488b3..5c864c967c 100644 --- a/evals/session_search_schema/runner.py +++ b/evals/session_search_schema/runner.py @@ -36,6 +36,7 @@ REPO_ROOT = EVAL_DIR.parent.parent sys.path.insert(0, str(EVAL_DIR)) sys.path.insert(0, str(REPO_ROOT)) +from agent.compression_marker import elide # noqa: E402 from tasks import SYSTEM, TASKS # noqa: E402 ALLOWED_KEYS = { @@ -177,7 +178,7 @@ def run_one(client, model, arm_name, arm_mod, task_id, prompt, oracle, if was_err: bad_calls += 1 if len(out) > 30000: - out = out[:30000] + "...[truncated]" + out = elide(out, 30000) messages.append( {"role": "tool", "tool_call_id": tc.id, "content": out}) return { diff --git a/tools/delegate_tool_child_run.py b/tools/delegate_tool_child_run.py index 1da0c5d38e..0e12ce2b67 100644 --- a/tools/delegate_tool_child_run.py +++ b/tools/delegate_tool_child_run.py @@ -11,6 +11,7 @@ import threading import time from concurrent.futures import TimeoutError as FuturesTimeoutError from typing import Any, Dict, List, Optional +from agent.compression_marker import elide from agent.interrupt_compat import request_hard_interrupt from dataclasses import dataclass, field from tools import file_state @@ -182,9 +183,7 @@ def _dump_subagent_timeout_diagnostic( subagent_id = getattr(child, "_subagent_id", None) or f"idx{task_index}" dump_path = logs_dir / f"subagent-timeout-{subagent_id}-{_dt.datetime.now().strftime('%Y%m%d_%H%M%S')}.log" - _goal_preview = (goal or "").strip() - if len(_goal_preview) > 1000: - _goal_preview = _goal_preview[:1000] + " ...[truncated]" + _goal_preview = elide((goal or "").strip(), 1000) def _attr_line(attr): try: return f" {attr}: {getattr(child, attr, None)!r}"