Skip to content

The agent that grows with you

refactor(agent): hoist the hidden placeholder row import and say why a timeout carries no message

kshitijk4poor70dcdd640f0d
diff --git a/agent/conversation_loop.py b/agent/conversation_loop.py
index 5c54a1908cf..8a6c22d6079 100644
--- a/agent/conversation_loop.py
+++ b/agent/conversation_loop.py
@@ -15,6 +15,7 @@ import time
from dataclasses import dataclass, field, fields
from typing import Any, Dict, List, Optional
+from agent.agent_runtime_helpers_placeholders import hidden_interrupt_placeholder_row
from agent.codex_responses_adapter import _summarize_user_message_for_log
from agent.fast_mode import begin_turn as begin_fast_mode_turn
from agent.message_metadata import append_message, without_persistence_fields
@@ -345,7 +346,6 @@ def _apply_active_turn_redirect(agent: Any, messages: List[Dict[str, Any]], text
if not (messages and messages[-1].get("role") == "assistant"):
# Hidden row with a neutral api_content (#88955). Never _INTERRUPT_SCAFFOLD_MARKER:
# as assistant text the model echoes it (#81841).
- from agent.agent_runtime_helpers_placeholders import hidden_interrupt_placeholder_row
append_message(messages, {"role": "assistant", "content": visible} if visible else hidden_interrupt_placeholder_row())
# Transcript shows the user's own words; the provider replays the scaffolded form.
append_message(messages, {"role": "user", "content": text, "api_content": correction})
diff --git a/agent/terminal_approval_batch.py b/agent/terminal_approval_batch.py
index da46a77dee1..664536b5abb 100644
--- a/agent/terminal_approval_batch.py
+++ b/agent/terminal_approval_batch.py
@@ -312,8 +312,8 @@ def terminal_approval_batch(agent, calls, messages, task_id):
batch.close()
# A cancellation means a stop is already published (or our own
# close() ran): re-interrupting would overwrite the user's queued
- # message/redirect. A timeout is a system stop: attribute it via
- # tool_reason with no message, which callers re-queue as a user turn.
+ # message/redirect. A timeout is a system stop: tool_reason only, no
+ # message (callers re-queue _interrupt_message as the user's next turn).
if isinstance(exc, TimeoutError):
agent.interrupt(tool_reason="terminal batch preparation timeout")
# The sequential path must still persist a result for every