mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-16 06:19:21 +00:00
A WS disconnect does not imply the VST sidecar process was torn down — startVstSidecar() is a singleton reused across reconnects in the common case, so its server-side _tracks dict survives. useVstHost previously cleared its trackIndex mirror on every disconnect on the false premise that a reconnect always gets a fresh, empty sidecar, while useVstPreview's crash-fallback auto-reconnect wiped its own "already loaded" bookkeeping and silently re-issued load-chain for every previously-streamed track. The server's real (never-reset) index-assignment rule could then hand those re-loaded tracks a colliding trackIndex that the client's freshly-recomputed mirror had no way to detect. Stop clearing trackIndexRef on disconnect (it's a more accurate mirror left as-is than reset to a false "confirmed empty" state), and track which trackIds were streaming at disconnect time so the "Load chains" effect never auto-reloads them again — they stay in dry fallback until something explicitly re-triggers a load, matching this file's existing "degrade to dry when index safety can't be guaranteed" pattern. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>