diff --git a/tests/tools/test_delegate_subagent_timeout_diagnostic.py b/tests/tools/test_delegate_subagent_timeout_diagnostic.py index a94f0a095e..05d8269626 100644 --- a/tests/tools/test_delegate_subagent_timeout_diagnostic.py +++ b/tests/tools/test_delegate_subagent_timeout_diagnostic.py @@ -112,6 +112,26 @@ class TestDumpSubagentTimeoutDiagnostic: # We assert no exception propagates — the return value is advisory. assert result is None or Path(result).exists() + def test_timeout_diagnostic_marks_long_goal_as_non_original(self, hermes_home): + # #121572: an elided goal must carry the non-imitable counted marker, + # never the bare "...[truncated]" the model could copy. + from agent.compression_marker import _COMPRESSION_MARKER_RE + from tools.delegate_tool import _dump_subagent_timeout_diagnostic + child = _StubChild() + path = _dump_subagent_timeout_diagnostic( + child=child, + task_index=0, + timeout_seconds=300.0, + duration_seconds=300.0, + worker_thread=None, + goal="g" * 1200, + ) + child.interrupt() + text = Path(path).read_text(encoding="utf-8-sig") + assert _COMPRESSION_MARKER_RE.search(text) + assert "g" * 100 in text + assert "...[truncated]" not in text + # ── _run_single_child timeout branch wiring ───────────────────────────