Skip to content

The agent that grows with you

fix: cover the title_preview wire seam and the widened _run_after_agent_ready call

teknium1490bd2093bcc
diff --git a/tests/agent/test_turn_context.py b/tests/agent/test_turn_context.py
index d285390277c..60644c46feb 100644
--- a/tests/agent/test_turn_context.py
+++ b/tests/agent/test_turn_context.py
@@ -535,3 +535,17 @@ def test_prologue_does_not_title_machine_driven_runs(platform):
overwritten or never read.
"""
assert not _title_turn(platform).called
+
+
+def test_prologue_forwards_the_submit_title_preview_to_the_titler():
+ """A paste-shrunk ``display_metadata.title_preview`` from prompt.submit is the text the
+ titler should read, not the full pasted body."""
+ from agent import turn_context
+
+ with patch("agent.title_generator.maybe_auto_title") as titler:
+ turn_context._maybe_title_session_at_turn_start(
+ _TitlingAgent("desktop"),
+ [{"role": "user", "content": "x" * 5000,
+ "display_metadata": {"title_preview": "Pasted 5000 chars"}}],
+ )
+ assert titler.call_args.kwargs["title_preview"] == "Pasted 5000 chars"
diff --git a/tests/tui_gateway/test_submit_time_user_row.py b/tests/tui_gateway/test_submit_time_user_row.py
index 85d303c7ffc..8d8e41efdd3 100644
--- a/tests/tui_gateway/test_submit_time_user_row.py
+++ b/tests/tui_gateway/test_submit_time_user_row.py
@@ -92,7 +92,7 @@ def test_failed_build_drops_the_staged_row_and_a_later_turn_never_adopts_it(monk
session["running"] = True
server._start_inflight_turn(session, "please refactor the login page")
assert server._persist_session_row_for_submit("rid", session, "please refactor the login page", None) is None
- server._run_after_agent_ready("rid", sid, session, "please refactor the login page", None, None)
+ server._run_after_agent_ready("rid", sid, session, "please refactor the login page", None, None, None)
assert "_submit_user_row" not in session, "staged row survived a turn that never reached the agent"
# Even if a staged row were still around, a turn whose raw submit differs must leave the DB alone.