fix(agent): report THREAD_REPAIRED as lifecycle error code

The send-path repair branch set _request_result but not
_request_error_code, so the AGENT_REQUEST_FAILED lifecycle event fell back
to the misleading 'agent lifecycle failure'. Set THREAD_REPAIRED so logs
and middleware show the real outcome.
This commit is contained in:
2026-08-19 20:14:50 +03:00
parent a619c0afb2
commit 455a56856f

View File

@@ -1081,6 +1081,7 @@ async def agent_handler( # noqa: C901 — intentionally complex C4 orchestratio
extra={"src": "AgentChat.GradioApp.Handler"},
)
_request_result = "failed"
_request_error_code = "THREAD_REPAIRED"
yield json.dumps(
{
"content": "⚠️ Предыдущий запуск был прерван. Поток восстановлен — отправьте запрос ещё раз.",