Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
The page reconnects /live by itself within 1 s (backoff 0.25 to 2 s) behind a small 'reconnecting…' chip, never reloading #255
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
When /live closes, the page now retries on its own after 0.25, 0.5, 1, then 2 s at most, and never reloads. The new tests pass. In the full bun test run, 486 passed and one failed: the model-routes test in server.test.ts:543, which expects the vendored three.js file and got a 404.
shipped merged
1 earlier comment · 1 event
When /live closes, the page now retries on its own after 0.25, 0.5, 1, then 2 s at most, and never reloads. The new tests pass. In the full bun test run, 486 passed and one failed: the model-routes test in server.test.ts:543, which expects the vendored three.js file and got a 404. I think that is because node_modules is missing here (bun install can't write to its tempdir in this sandbox). I didn't confirm that. I didn't run tsc, and I didn't check the first-visit gzip budget by itself or look at the page in a browser.
- Backoff:
backoff(attempt)insrc/ui/lobby-panel.jssets the delay, and the first message from the server resets it to 0.25 s. The session cookie is unchanged, so the identity stays the same. - Chip:
#reconnectin the status strip ofsrc/viewer.htmlis a small "reconnecting…" chip. It is positioned absolutely and hidden withvisibility, so it reserves its space and nothing shifts. It appears on close and clears on the first message. - No "simulated": on close the page calls
noStatus(), so the arm line reads "no arm" or "reconnecting…" instead of the last "Simulated". - While disconnected: the page has no
hello, somayDrive()is false. The drive controls are inert,stream.openrefuses to start, andsay()sends nothing. - Tests: in
lobby-panel.test.ts, a fake WebSocket checks that the delays are 250, 500, 1000, 2000, 2000, 2000. The same test checks that the chip shows and clears, that nothing is sent while down, that a message resets the backoff, and thatlocation.reloadis never called. - Not changed:
forge.json.
When someone joins, the page closes /live on purpose to reopen it and learn who they are. The chip now flashes briefly during that reopen.
🤖 Generated with Claude Code
The retry itself is right: 250/500/1000/2000 ms, no reload, controls inert while down, backoff reset on first message, and the test covers it. Two experience misses, fix the first one first.
- The chip sits on the E-stop. #reconnect is absolute at top:2px; right:8px in a 64px strip with 8px padding, and the 56px E-stop is the right-most item, so the 16px chip covers its top edge on a phone. Nothing may overlap the safety control. Put the chip in the flow, inside .who under #driverLine, with its height reserved (visibility:hidden keeps the box), or fold it into the existing #capLine row. Then drop position:relative from #strip.
- The chip flashes on every join. The page closes /live on purpose to reopen it, which now sets the chip, calls noStatus() and writes Connecting... for a beat. People will read that as an outage. Mark the deliberate close (a flag set before ws.close()) and skip the chip/noStatus path for it, or show the chip only after about 400 ms of still being down. Add a test for it.
Smaller: lobby.timer is assigned but never read, so remove it or use it. The wording changed from Reconnecting... to Connecting... in driverLine, which is now inconsistent with the chip text. Use one word. No tsc was run; run bun x tsc --noEmit before the next push.
Both misses are fixed and pushed, and bun x tsc --noEmit is now clean. I ran src/ui, server.test.ts and compress.test.ts (163 pass, 0 fail). I didn't re-run the whole suite, and I haven't looked at the chip in a browser.
- E-stop overlap: the
#reconnectchip now sits in the flow inside.who, under#driverLine. It is hidden withvisibility, so its box stays reserved and nothing shifts. I removed the absolute positioning and theposition:relativeon#strip, so nothing overlaps the E-stop. - Flash on join: the join handler sets
lobby.reopeningbefore it closes/live. Inws.onclose, a close with that flag set locks the controls and reconnects at once. It shows no chip, calls nonoStatus()and writes no "Reconnecting…". A new test submits the join form and checks that a second socket opens straight away, with no retry delay, no chip and nonoStatuscall. - Smaller: I removed the unused
lobby.timer. The driver line says "Reconnecting…" again, so it matches the chip.
The first tsc run, now that dependencies are installed, caught a type error in my new test. I fixed it.
I kept the one-word wording but not the capital letter: the chip says "reconnecting…" in lowercase, as the issue asks, and the driver line says "Reconnecting…".
🤖 Generated with Claude Code
Works as asked: the preview serves the #reconnect chip, backoff is 250/500/1000/2000 ms capped, the chip clears on the first message, controls lock and nothing is sent while down, no reload. The chip is hidden with visibility, so there is no layout shift. Tests cover the delays, the chip, no sends and the deliberate reopen. Two things I would do next: (1) lobby.reopening is set in the join handler even when lobby.ws is already null, so the flag stays set and the next real outage skips the chip and the backoff once; set it only when a socket was actually closed. (2) The chip is a role=status inside an aria-live=polite strip, which is fine, but check on a 360px phone that the extra chip row does not push the E-stop or the video box.
When
/livecloses, the page now retries on its own after 0.25, 0.5, 1, then 2 s at most, and never reloads. The new tests pass. In the fullbun testrun, 486 passed and one failed: the model-routes test inserver.test.ts:543, which expects the vendored three.js file and got a 404. I think that is becausenode_modulesis missing here (bun installcan't write to its tempdir in this sandbox). I didn't confirm that. I didn't runtsc, and I didn't check the first-visit gzip budget by itself or look at the page in a browser.backoff(attempt)insrc/ui/lobby-panel.jssets the delay, and the first message from the server resets it to 0.25 s. The session cookie is unchanged, so the identity stays the same.#reconnectin the status strip ofsrc/viewer.htmlis a small "reconnecting…" chip. It is positioned absolutely and hidden withvisibility, so it reserves its space and nothing shifts. It appears on close and clears on the first message.noStatus(), so the arm line reads "no arm" or "reconnecting…" instead of the last "Simulated".hello, somayDrive()is false. The drive controls are inert,stream.openrefuses to start, andsay()sends nothing.lobby-panel.test.ts, a fake WebSocket checks that the delays are 250, 500, 1000, 2000, 2000, 2000. The same test checks that the chip shows and clears, that nothing is sent while down, that a message resets the backoff, and thatlocation.reloadis never called.forge.json.When someone joins, the page closes
/liveon purpose to reopen it and learn who they are. The chip now flashes briefly during that reopen.🤖 Generated with Claude Code
Closes #234