Skip to content

Ask for a reload when the live view drops, and only say shut down when it is - #488

Draft
tnsardesai wants to merge 1 commit into
mainfrom
hypeship/live-view-reconnect
Draft

tnsardesai wants to merge 1 commit into
mainfrom
hypeship/live-view-reconnect

Conversation

@tnsardesai

@tnsardesai tnsardesai commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The live view showed "Browser has been shut down and is no longer available" whenever its connection dropped after connecting, whether or not the browser was gone. app.vue renders that overlay for any !connected && wasConnected. So a network change, or a TURN relay that stops answering, told the viewer the browser had shut down while it was still running, and nothing on the page offered a way back. A viewer that believes the browser is gone doesn't reconnect, so the session stops counting as active and can idle out shortly after, which then makes the message true.

This makes the overlay say which one happened, and offers a reload when the browser may still be running. It doesn't add automatic retry: #417's decision stands, and a connected viewer that drops still ends the connection and posts nothing new to the parent frame.

Changes

  • Two overlay states.
    • The live-view proxy closed the socket with 4410 (session gone): "Browser has been shut down and is no longer available", as before.
    • Any other close after connecting: "Lost connection to the browser", with a Reload button that reloads the page.
  • neko's connection shutdown no longer pops a modal. neko sends system/disconnect with connection shutdown as it stops, on a restart and on browser teardown alike, and the client treated it as a server disconnect with a "Disconnected" modal over the overlay. That message is now left to the socket close that follows, which decides the state. Other server reasons (kicked, connection replaced, ...) are unchanged.
  • First connects are unchanged: same stage bounds, same single terminal parent event.

The proxy sends 4410 to a connected viewer once kernel/kernel#5023 ships; today it only sends it when a wake finds the instance gone. The two can ship in either order: until the proxy change is out, a torn-down browser shows "Lost connection" with Reload, and, from the proxy code, reloading a deleted session returns "Browser session no longer exists".

Testing

  • bun test tests: 256 pass. New tests:

    • a 4410 close after connecting marks the session gone and opens no new socket;
    • any other close after connecting leaves it not gone, and opens no new socket;
    • the overlay state for a gone and a not-gone disconnect;
    • connection shutdown versus other server disconnect reasons.

    5 of them fail against main.

  • npm run build passes, with the same 17 lint warnings as main. Prettier is clean. The production bundle still contains the websocket URL string the proxy rewrites to append the token, exactly once.

  • End to end on a production headful image with this client swapped in, driven from headless Chromium 155:

    Trigger Result
    Outbound UDP dropped on the viewer's machine (ICE fails about 5s in) "Lost connection" with Reload; no new socket in the next 15s; Reload had video playing 2s later
    supervisorctl restart neko "Lost connection" with Reload and no modal; Reload recovered once neko was back
    Browser deleted while viewing (production proxy, without the companion change) "Lost connection" with Reload, no modal, no new socket

    On main, the first two show "Browser has been shut down" with the browser still running. The 4410 → "shut down" path is covered by unit tests here and by the proxy tests in the companion PR.

Not covered: the image build and a fresh boot with this client, and Safari or Firefox.

@tnsardesai
tnsardesai force-pushed the hypeship/live-view-reconnect branch from 2b99563 to 0e05bf3 Compare October 27, 2026 04:56
@tnsardesai tnsardesai changed the title Reconnect the live view after a drop, and only say shut down when it is Ask for a reload when the live view drops, and only say shut down when it is Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant