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.""" """WebSocket terminal endpoint for tool instances."""
import asyncio
import logging import logging
import uuid import uuid
@@ -82,16 +83,10 @@ async def terminal_websocket(
# Send connected status # Send connected status
await websocket.send_json({"type": "status", "status": "connected"}) await websocket.send_json({"type": "status", "status": "connected"})
# Keep connection alive until closed # Keep connection alive until session ends
while True: # The terminal_manager handles I/O loops, we just wait here
try: while session.is_alive() and not session._closed:
message = await websocket.receive() await asyncio.sleep(0.5)
if message["type"] == "websocket.disconnect":
break
except WebSocketDisconnect:
break
except RuntimeError:
break
except Exception as exc: except Exception as exc:
logger.error("Terminal session error for instance %s: %s", instance_id, str(exc), exc_info=True) logger.error("Terminal session error for instance %s: %s", instance_id, str(exc), exc_info=True)