The AI Runner runs on a dedicated background thread with its own asyncio event loop. When it emitted WebSocket events via sio.emit(), the call happened on the wrong loop (AI Runner's vs ASGI/Quart's), causing silent failures — messages were saved to MongoDB but never reached the frontend. Additionally, the frontend HTTP polling fallback was never enabled when WebSocket appeared connected, leaving no way to discover missed messages. - websocket_manager_async.py: store ASGI main loop reference; detect cross-loop calls in emit_to_focus_group and use run_coroutine_threadsafe to schedule emits on the correct loop - __init__.py: register the ASGI event loop with the WebSocket manager in before_serving hook - FocusGroupSession.tsx: always poll fetchMessages every 3s during AI mode as a reliability fallback regardless of WebSocket status Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| auth | ||
| models | ||
| routes | ||
| services | ||
| utils | ||
| .DS_Store | ||
| __init__.py | ||
| db.py | ||
| extensions.py | ||
| websocket_debug_tap.py | ||
| websocket_manager.py | ||
| websocket_manager_async.py | ||