fix(agent): close reasoning on stream timeout

This commit is contained in:
chengyongru
2026-07-14 15:51:22 +08:00
committed by chengyongru
parent 11eb9d8cc8
commit 4916fc07ab
3 changed files with 67 additions and 7 deletions
+7 -6
View File
@@ -824,16 +824,17 @@ class AgentRunner:
)
except asyncio.TimeoutError:
if outer_timeout_s is None:
return LLMResponse(
response = LLMResponse(
content="Error calling LLM: stream stalled",
finish_reason="error",
error_kind="timeout",
)
return LLMResponse(
content=f"Error calling LLM: timed out after {outer_timeout_s:g}s",
finish_reason="error",
error_kind="timeout",
)
else:
response = LLMResponse(
content=f"Error calling LLM: timed out after {outer_timeout_s:g}s",
finish_reason="error",
error_kind="timeout",
)
if progress_state and progress_state.get("reasoning_open"):
await hook.emit_reasoning_end()
dropped, all_dropped, original_finish_reason = (