mirror of
https://github.com/turnstonelabs/turnstone.git
synced 2026-08-23 04:14:47 -06:00
d7cea053b6
Multiple browser tabs open to the same server could see workstream names, states, and content mixed up between workstreams when creating, closing, and switching tabs rapidly. Root causes and fixes: - Global SSE ws_created events were never handled — other tabs never learned about new workstreams, causing blank names and stale tab bars - SSE reconnection assigned all stale panes to the first workstream instead of deduplicating; now uses two-pass assignment with tracking - switchTab left the old EventSource open while reassigning pane.wsId, creating a window for events to leak; now disconnects SSE first - Per-workstream events carried no ws_id — server now stamps ws_id on all events via _enqueue (shallow copy); client handleEvent drops events with mismatched ws_id as defense-in-depth - Plan dialog used pane.wsId at resolve time (could drift after tab switch); now captures ws_id when the dialog opens - Global ws_closed could reassign panes before per-ws SSE finished draining; now disconnects per-ws SSE immediately on close