fix(terminal): remove duplicate WebSocket read loop, let terminal_manager handle I/O

This commit is contained in:
Fusion
2026-05-21 11:19:11 +02:00
parent 76266fc3d0
commit a200955ef2
+5 -10
View File
@@ -1,5 +1,6 @@
"""WebSocket terminal endpoint for tool instances."""
import asyncio
import logging
import uuid
@@ -82,16 +83,10 @@ async def terminal_websocket(
# Send connected status
await websocket.send_json({"type": "status", "status": "connected"})
# Keep connection alive until closed
while True:
try:
message = await websocket.receive()
if message["type"] == "websocket.disconnect":
break
except WebSocketDisconnect:
break
except RuntimeError:
break
# Keep connection alive until session ends
# The terminal_manager handles I/O loops, we just wait here
while session.is_alive() and not session._closed:
await asyncio.sleep(0.5)
except Exception as exc:
logger.error("Terminal session error for instance %s: %s", instance_id, str(exc), exc_info=True)