semblance/src
Vadym Samoilenko b4978989a5 Fix AI autonomous mode: cross-loop WebSocket emit + polling fallback
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>
2026-03-23 18:22:24 +00:00
..
components Fix data isolation + conversation/decision 500 errors 2026-03-23 17:02:10 +00:00
config Remove console.log debug calls from frontend browser console 2026-03-23 14:30:56 +00:00
contexts Remove console.log debug calls from frontend browser console 2026-03-23 14:30:56 +00:00
hooks Migrate task result delivery from WebSocket to HTTP polling 2026-03-23 16:46:58 +00:00
lib Fix data isolation + conversation/decision 500 errors 2026-03-23 17:02:10 +00:00
pages Fix AI autonomous mode: cross-loop WebSocket emit + polling fallback 2026-03-23 18:22:24 +00:00
services Remove console.log debug calls from frontend browser console 2026-03-23 14:30:56 +00:00
styles changed permissions 2025-12-19 19:26:16 +00:00
types changed permissions 2025-12-19 19:26:16 +00:00
utils Remove console.log debug calls from frontend browser console 2026-03-23 14:30:56 +00:00
.DS_Store changed permissions 2025-12-19 19:26:16 +00:00
App.tsx changed permissions 2025-12-19 19:26:16 +00:00
index.css changed permissions 2025-12-19 19:26:16 +00:00
main.tsx Switch to loginRedirect — popup blocked by server COOP header 2026-03-20 14:44:19 +00:00
vite-env.d.ts changed permissions 2025-12-19 19:26:16 +00:00