The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(kanban): detect WS client disconnect on idle board, prevent zombie poll tasks
Tugrul Guner44665783a936
diff --git a/plugins/kanban/dashboard/plugin_api.py b/plugins/kanban/dashboard/plugin_api.pyindex 47077d93902..ade9fa140e7 100644--- a/plugins/kanban/dashboard/plugin_api.py+++ b/plugins/kanban/dashboard/plugin_api.py@@ -2946,10 +2946,24 @@ async def stream_events(ws: WebSocket):conn.close()while True:+ # Race receive() against the poll interval to detect client+ # disconnect even when no events are being sent. Without this,+ # a disconnect is only detected via send_json() raising+ # WebSocketDisconnect, so an idle board leaks zombie poll tasks.+ try:+ msg = await asyncio.wait_for(+ ws.receive(), timeout=_EVENT_POLL_SECONDS+ )+ if msg["type"] == "websocket.disconnect":+ return+ # Any other client message (pong, text) is ignored; we+ # continue polling.+ except asyncio.TimeoutError:+ pass # no client message — poll the DB+cursor, events = await asyncio.to_thread(_fetch_new, cursor)if events:await ws.send_json({"events": events, "cursor": cursor})- await asyncio.sleep(_EVENT_POLL_SECONDS)except WebSocketDisconnect:returnexcept asyncio.CancelledError: