From 7cffa1895f7a5f0ea3cdbefc0f76931555fb72e6 Mon Sep 17 00:00:00 2001 From: Zamil Majdy Date: Wed, 11 Feb 2026 06:52:47 +0400 Subject: [PATCH] fix(backend/chat): Filter duplicate StreamStart from non-SDK path Routes.py already publishes a StreamStart before calling the service. The SDK path filters the duplicate internally, but the non-SDK path did not, causing two StreamStart events to reach the frontend. --- autogpt_platform/backend/backend/api/features/chat/routes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/autogpt_platform/backend/backend/api/features/chat/routes.py b/autogpt_platform/backend/backend/api/features/chat/routes.py index 0fc0f2ff51..8aa3ef08a1 100644 --- a/autogpt_platform/backend/backend/api/features/chat/routes.py +++ b/autogpt_platform/backend/backend/api/features/chat/routes.py @@ -417,6 +417,9 @@ async def stream_chat_post( session=session, # Pass session with message already added context=request.context, ): + # Skip duplicate StreamStart — we already published one above + if isinstance(chunk, StreamStart): + continue chunk_count += 1 if first_chunk_time is None: first_chunk_time = time_module.perf_counter()