Skip to content

Fix WiFi setup flow leaving the board unreachable on failure - #108

Merged
eliasbakken merged 1 commit into
mainfrom
fix/wifi-connect-hotspot-fallback-90
Aug 11, 2026
Merged

Fix WiFi setup flow leaving the board unreachable on failure#108
eliasbakken merged 1 commit into
mainfrom
fix/wifi-connect-hotspot-fallback-90

Conversation

@eliasbakken

Copy link
Copy Markdown
Contributor

Summary

  • `wifi-connect` now restores the Recore hotspot AP if the station-mode connection fails (bad password, AP out of range, DHCP timeout) - previously the board was left in station mode with no connection and no hotspot, unreachable until physical intervention
  • Frontend WiFi-connect polling is bounded to 15s instead of polling forever - once the board tears down its own hotspot to switch networks, that origin is gone for good regardless of outcome, so polling it can never observe a result. Shows reconnect guidance after the bound
  • Added a persistent status line to the WiFi setup page so it shows what's actually happening at each step
  • Added a global axios timeout (10s) - several other polling loops had no per-call timeout, and confirmed live that a request against a dead origin can hang completely silently (same root cause as Log stream stops working after connecting to an external AP #95); enough of those piling up starves the browser's connection pool and blocks even timeout-protected requests from getting a socket
  • Fixed a related first-boot race in `expand-usb` found while testing: `fdisk`'s in-place partition table re-read can fail with "Device or resource busy" even though the write succeeded - now waits for the device node instead of trusting fdisk's exit code
  • Disabled production sourcemaps (`vue.config.js`) - the board's rootfs is a small initrd ramdisk and repeated deploys without this filled it completely during testing

Closes #90

Test plan

  • Live-tested backend fallback: ran `wifi-connect` against a nonexistent SSID, confirmed the board fell back to broadcasting the Recore hotspot instead of being stranded
  • Live-tested the full frontend flow on real hardware across several iterations (including diagnosing and fixing the connection-pool-starvation bug found mid-testing)
  • go test ./... and bats test/bats (16 tests, including 2 new ones for the hotspot fallback) pass

🤖 Generated with Claude Code

Two real gaps, per the issue:

1. wifi-connect never restored the hotspot AP if the station-mode
   connection failed (bad password, AP out of range, DHCP timeout) -
   the board was left in station mode with no working connection and
   no hotspot, unreachable until physical intervention. It now falls
   back to the Recore hotspot on any connection failure, live-tested
   against a nonexistent SSID.

2. The frontend polled the pre-switch origin for the outcome
   indefinitely. Once the board tears down its own hotspot to switch
   networks, that origin is gone for good regardless of outcome, so
   polling it can never observe a result. Bounded to a 15s window,
   after which the UI shows guidance to reconnect and continue at
   recore.local instead of spinning forever. Also added a persistent
   status line so the page shows what's actually happening at each
   step instead of relying on toast notifications alone.

Both fixes required a global axios timeout (client/src/main.js):
several other polling loops (WiFi status, transfer progress, ...) had
no per-call timeout, and a request against a dead origin can hang
completely silently with no error ever firing (confirmed live, same
root cause as #95) - enough of those piling up at once starves the
browser's small same-origin connection pool, so even a request with
its own timeout can't get a socket to run on. A global default bounds
every request that doesn't set its own.

Also fixes a related first-boot race in expand-usb found while testing
this: fdisk's own in-place partition table re-read can fail with
"Device or resource busy" even though the write itself succeeded - the
kernel picks up the new partition via udev shortly after regardless,
so wait for the device node instead of trusting fdisk's exit code.

Closes #90
@eliasbakken
eliasbakken merged commit e541359 into main Aug 11, 2026
1 check passed
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.

WiFi credentials flow: unbounded polling against a dead origin, no hotspot fallback on failure

1 participant