Compare commits

...

1 Commits

Author SHA1 Message Date
Bentlybro
d488bfdda7 fix(backend): Handle StreamHeartbeat in CoPilot stream handler
StreamHeartbeat chunks were being yielded from tool execution
(to keep SSE connections alive during long-running operations)
but the main stream_chat_completion handler had no case for them
in its elif chain. They fell through to the 'Unknown chunk type'
error path, generating Sentry errors (AUTOGPT-SERVER-7JA).

Fix: Add StreamHeartbeat to the elif chain and yield it through
so it reaches the route handler which calls to_sse() on it,
producing the expected SSE comment format (': heartbeat').
2026-02-02 14:11:13 +00:00

View File

@@ -607,6 +607,9 @@ async def stream_chat_completion(
total_tokens=chunk.totalTokens,
)
)
elif isinstance(chunk, StreamHeartbeat):
# Pass through heartbeat to keep SSE connection alive
yield chunk
else:
logger.error(f"Unknown chunk type: {type(chunk)}", exc_info=True)