From b1eeb651f60e6392ab8709ceacbaad5eb2845f1c Mon Sep 17 00:00:00 2001 From: Igor Loskutov Date: Mon, 9 Feb 2026 15:26:59 -0500 Subject: [PATCH] fix: send last DAG_STATUS on WebSocket connect instead of skipping all Previously all DAG_STATUS events were skipped during historical replay on WS connect, so reconnecting clients (React strict mode remount, page navigation) lost current DAG state. Now sends only the most recent DAG_STATUS event on connect. --- server/reflector/views/transcripts_websocket.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/server/reflector/views/transcripts_websocket.py b/server/reflector/views/transcripts_websocket.py index fae25eed..8aeb3e1b 100644 --- a/server/reflector/views/transcripts_websocket.py +++ b/server/reflector/views/transcripts_websocket.py @@ -41,13 +41,19 @@ async def transcript_events_websocket( try: # on first connection, send all events only to the current user + # Find the last DAG_STATUS to send after other historical events + last_dag_status = None for event in transcript.events: - # for now, do not send TRANSCRIPT or STATUS options - theses are live event - # not necessary to be sent to the client; but keep the rest name = event.event - if name in ("TRANSCRIPT", "STATUS", "DAG_STATUS"): + if name in ("TRANSCRIPT", "STATUS"): + continue + if name == "DAG_STATUS": + last_dag_status = event continue await websocket.send_json(event.model_dump(mode="json")) + # Send only the most recent DAG_STATUS so reconnecting clients get current state + if last_dag_status is not None: + await websocket.send_json(last_dag_status.model_dump(mode="json")) # XXX if transcript is final (locked=True and status=ended) # XXX send a final event to the client and close the connection