AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(backend): register AutoPilot sessions with stream registry for SSE updates (#12500)
### Changes 🏗️ - When the AutoPilot block executes a copilot session via `collect_copilot_response`, it calls `stream_chat_completion_sdk` directly, bypassing the copilot executor and stream registry. This means the frontend sees no `active_stream` on the session and cannot connect via SSE — users see a frozen chat with no updates until the turn fully completes. - Fix: register a `stream_registry` session in `collect_copilot_response` and publish each chunk to Redis as events are consumed. This allows the frontend to detect `active_stream=true` and connect via the SSE reconnect endpoint for live streaming updates during AutoPilot execution. - Error handling is graceful — if stream registry fails, AutoPilot still works normally, just without real-time frontend updates. ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Trigger an AutoPilot block execution that creates a new chat session - [x] Verify the new session appears in the sidebar with streaming indicator - [x] Click on the session while AutoPilot is still executing — verify SSE connects and messages stream in real-time - [x] Verify that after AutoPilot completes, the session shows as complete (no active_stream) - [x] Test reconnection: disconnect and reconnect while AutoPilot is running — verify stream resumes (found and fixed GeneratorExit bug that caused stuck sessions) - [x] E2E: 10 stream events published to Redis (StreamStart, 3×ToolInput, 3×ToolOutput, TextStart, TextEnd, StreamFinish) - [x] E2E: Redis xadd latency 0.2–3.4ms per chunk - [x] E2E: Chat sessions registered in Redis (confirmed via redis-cli)
Z
Zamil Majdy committed
550fa5a31924e2d03f8d9e99a7e2dcb5e0052e74
Parent: 8528dff
Committed by GitHub <noreply@github.com>
on 3/25/2026, 1:08:49 AM