mirror of
https://github.com/stablyai/orca.git
synced 2026-10-19 08:03:13 +00:00
Three independent bugs that combined to cause the rare blank-terminal state where xterm shows nothing but server input still works: 1. Scrollback handler set initializedHandlesRef even when getTerminalRef returned null (WebView not mounted). The init() message went nowhere but the flag stayed true, so any subsequent scrollback for the handle was silently dropped — xterm never got a buffer. Now only mark initialized when init() actually reaches a live WebView ref. 2. Stale-event filter dropped 'scrollback' events with seq < last when the regress was <= 20. After a WS reconnect or resubscribe the server may emit scrollback at a lower seq than what we saw pre-reconnect, leaving the user with a blank terminal. Scrollback is the response to a fresh subscribe — it should always reset the high-water mark. The filter now only applies to 'resized' events. 3. Added defensive logging in the 'data' handler so the next time blank happens we can see whether sends are being silently dropped because getTerminalRef returned null. Co-authored-by: Orca <help@stably.ai>