fix(runtime): preserve provider error terminal ordering

This commit is contained in:
Alexandre Teixeira
2026-10-01 00:33:46 +01:00
parent fe80eb795e
commit 466a6b323a
5 changed files with 273 additions and 12 deletions
+3 -1
View File
@@ -26258,6 +26258,9 @@ async def stream_agent_loop(
# next model request. Do not expose a transient provider
# error or terminate the turn before that retry.
break
# Let the completion gate retain the original failure even
# when earlier tool evidence supplies useful fallback prose.
yield chunk
terminal_status = None
try:
error_line = next(
@@ -26547,7 +26550,6 @@ async def stream_agent_loop(
else "The model provider returned no usable output. No workspace change was made."
)
yield f'data: {json.dumps({"type": "final_response", "content": _failure_text})}\n\n'
yield chunk
# A terminal provider/request failure is not a completed Agent
# round. Stop before empty-response synthesis, metrics,
# teacher escalation, post-processing, or a success [DONE].