Repository navigation
fix(start-wrt): hand an outlasted update wait to the reconnect indicator - #4940
Dominion5254 wants to merge 14 commits into
Conversation
After an update reboot the UI probes the router for five minutes, then cleared its progress dialog without a word, leaving a page that still showed the old version. 1.5.0 makes that path reachable whenever the encrypted session cannot be re-admitted: a downgrade to firmware without /rpc/v2, or a future session-protocol change. The timeout now hands the wait to ConnectionService, the owner of the "Reconnecting" indicator that background pollers already report into once the update releases its suppression. It says the router has not come back since the update and reloads the page once the router answers any HTTP request, which loads the UI the running firmware serves. It probes the origin rather than polling system.info because the session this page speaks may be what that firmware no longer accepts.
helix-white
left a comment
There was a problem hiding this comment.
[P2] Preserve the update-timeout explanation through subsequent poller failures. The handover in system.service.ts supplies the new message, but ConnectionService.reportUnreachable() unconditionally replaces it before its already-unreachable guard. After the dialog closes, navigating to a polling page such as Devices causes FormService to report its next network failure without options, replacing the update explanation and reload promise with “Trying to reach the router.” The reload intent survives; its explanation does not. The added test stubs the connection owner, so it misses this transition.
The proposal initializes default copy on entry and preserves the active message on unlabelled reports. Explicit messages can still refine it, and recovery resets the context for the next outage. It records that contract at the owner and extends its lifecycle regression coverage through recovery and a fresh outage.
Comment cleanup: trims adjacent redundant prose and removes the assumption that every HTTP probe targets a different origin.
The reviewed head merges cleanly with origin/master. I did not build or run tests; the proposed test is unexecuted for the author to verify upon adoption.
Proposed changes: 2dab760...proposal/4940
To adopt the proposal, cherry-pick it onto your branch rather than merging or pulling it, so the PR's head stays your own commit:
git fetch https://github.com/Start9Labs/start-technologies.git proposal/4940
git cherry-pick 2dab760287e3ba3781ecd1d410b7306dea1e8da9..FETCH_HEADIf your branch has moved since 2dab760287e3ba3781ecd1d410b7306dea1e8da9, resolve any conflicts the cherry-pick reports, or apply the changes your own way. Then push and say so in a comment.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
Helix-Harness: pi Helix-Model: openai-codex/gpt-6.1-sol
…ervice The handover test stubbed the reconnect owner, so it could not see a later background report replace the explanation. It now constructs the real ConnectionService, lets the update wait expire into it, reports the outage again without options the way a FormService poller does, and checks that the explanation stays until the origin probe answers and the page reloads. A second case covers the address-change flow, whose page keeps polling after reconnectAt hands over.
… copy Keeping the active outage's message on unlabelled reports also stops the LAN IPv4 and Admin-profile pages' own pollers from replacing "Reconnecting to the new address…" with the generic copy while reconnectAt waits.
When the update wait ran out, the reconnect indicator reloaded the page once the router answered, but nothing told the reloaded page which version was requested. A slow update that succeeded reloaded with no "Updated to" confirmation, and one that came back on the old version reloaded with no failure message. The handover and the in-wait reload into a new interface now both store the requested version, and init() compares it with the version the router reports: a match shows "Updated to v…", anything else shows "Update failed — check device logs". init() checks it from system.info alone, so an unreachable registry cannot drop the outcome. It still honours the confirmed version an earlier release's update page stores before reloading. The fragment now says what the user sees: the update screen closes, a Reconnecting notice explains the wait, and the wait is several minutes rather than five (each of the 60 attempts is a 5 s pause plus a probe of up to 5 s). Tests drive the real ConnectionService through a handover into an outage already in progress, count the system.info calls the origin probe replaces, and check init()'s outcome for a match, a mismatch, an earlier release's key, no key, and an unreadable firmware.
The update handover probes the page's own origin and reloads, so the comments that assumed every probe targets a new address, that recovery always toasts "Connection restored", and that a declared disruption carries recovery intent no longer held. The progress dialog's doc now says what it does rather than listing SystemService's paths.
… version Pre-review findings on the outcome report: - The requested version was removed from sessionStorage before the reloaded page read system.info, so a failed first read lost the verdict for good. setInfo() now settles it, from init() as soon as system.info answers (without waiting for system.newer-versions, which can fail or stall) or from the 30 s refresh, and the key stays until a version is read. - SystemService takes sessionStorage and the window through WA_SESSION_STORAGE and WA_WINDOW, as the app's other window users do. - The handover reports the outage before writing storage, so a storage failure cannot cost the indicator. - The fragment says what is compared: whether the router runs the new version. - Comments that assumed sysupgrade clears sessions, that an update without a lost connection failed before rebooting, and that mock recovery only skips navigation are cut to what holds. Tests: the outcome keeps its key through an unreadable system.info until refresh() reads a version, arrives while system.newer-versions is still pending, and the update tests pass storage and window as fields and count toasts instead of throwing inside pollForReconnect's catch-all.
The reloaded page compared the version it was asked to install with the one the router reported and showed "Update failed — check device logs" on a mismatch. A router that answers while still downloading reports the old version, so the page could call a running update failed where the base said nothing. No verdict is correct until the router reports an update in progress, so the report goes: - startwrt.update-target, its write before the handover and the in-wait reload, and its settlement in setInfo()/init() are removed. - The in-wait reload into a new interface again stores the requested version under startwrt.updated-to and init() shows it, as on master. - The fragment no longer claims a verdict after the reload. SystemService keeps reaching sessionStorage and the window through WA_SESSION_STORAGE and WA_WINDOW for the uses that remain. Comments that assumed an update clears sessions or that a dropped stream without an outage means a failed update are cut to what holds. Tests: the outcome cases go; one test now drives the in-wait reload and the reloaded init() through the legacy key.
system.info needs no session, but an update keeps the session store, so the comment's claim that the check works "even when the update wiped the session" described a case that does not occur.
…eachable Once the update wait hands over, the reconnect indicator reloads the page on the first probe the origin answers. RPC can answer a moment before that probe, so "Update now" could start a second update that the reload then cut off from its progress. The button is disabled while ConnectionService reports the router unreachable, and SystemService.startUpdate refuses then as well, before it suppresses the indicator or sends system.update. The progress dialog closes when the update cannot start instead of spinning on an update that never began. The update fragment gains a line for the button.
Pre-review follow-ups on the "Update now" guard: - SystemService.canStartUpdate() holds the rule (not updating, router reachable); the button and startUpdate's refusal both use it. - A refused start toasts "Failed to start update" rather than repeating the indicator's "Trying to reach the router". - A test drives the progress dialog's start failure and checks that the dialog closes and toasts once. - Comments: system.info needs no sign-in (every RPC still needs the session), the toast's tailored-copy example names a caller that uses it, and two comments that restated the code are removed.
The refusal test asserted canStartUpdate() first, so before the guard it failed on the missing method rather than on an update that started. It now checks the refusal first. reachable()'s doc says "when" for a per-call result.
The dialog closes once its update has finished, not whenever SystemService is idle. The toast doc no longer argues for itself or gives an example the copy never shows. The coverage test for a handover into an outage already in progress goes: the "Update now" guard makes that state unreachable.
Pushed 2dab760..37e6817 (ae4b2a8 plus a docs-only master merge). |
helix-white
left a comment
There was a problem hiding this comment.
Re-review of 37e6817, which is ae4b2a8 plus a master merge that adds only master's docs change. My earlier request is resolved: the proposal is adopted unchanged, and the handover tests now drive the real ConnectionService. The rest of the push is correct:
- the "Update now" guard and its single
canStartUpdate()rule; - the dialog closing when a start fails;
- the
WA_SESSION_STORAGE/WA_WINDOWinjection; - the five dictionary entries;
- both changelog fragments. StartWRT v1.4.0 shipped both the silent timeout and the overwritten address message, so each fragment describes a fix to released behavior.
The head merges cleanly with master.
Brief
Summary
- Outlasted update wait. After an update, the progress dialog waits 60 attempts. Each is a 5 s pause plus a
system.infoprobe of up to 5 s, so the wait lasts 5 to 10 minutes. When it ran out, the dialog used to close silently on the old page.- It now closes into the existing "Reconnecting" notice, which reads "The router has not come back since the update. This page reloads when it does."
- The notice fetches
/static/local-root-ca.crtfrom the page's own origin every 3 s. The fetch is no-cors, so any HTTP answer counts. - On the first answer it reloads the page, which loads the UI the running firmware serves. The reload says nothing about whether the update succeeded.
- The notice keeps the message its outage started with, a change proposed in @helix-white's earlier review.
- Before,
reportUnreachable()set its message ahead of its already-unreachable check. The next report without a message replaced the copy with "Trying to reach the router"; a form page's 5 s poll is one such report. - It now sets the default only when an outage starts, and a later report changes the message only when it carries one. Recovery clears the outage's state.
- The same fix keeps "Reconnecting to the new address…" through the LAN IPv4 and Admin-profile address changes. Those pages keep polling while the browser waits to move to the new address.
- Before,
- "Update now" is disabled while the notice is up, for any outage, and
SystemService.startUpdaterefuses to start then. When an update cannot start, whether refused or rejected by the router, the progress dialog closes and shows the error as a toast ("Failed to start update" for a refusal). Before, a refused start would have left the dialog spinning. - Additional changes:
SystemServicereaches sessionStorage and the window through theWA_SESSION_STORAGE/WA_WINDOWinjection tokens. The "Updated to v…" confirmation across the in-wait reload behaves as on master.- Comments in both services are cut to their contracts: 103 comment lines removed, 20 added.
Implementation diff: +35 / −10 lines in 9 files (excludes lockfiles, tests, docs, release notes, and changelog). The count treats every comment line, // and doc comments alike, as documentation, and the five dictionary entries as implementation.
Approach
- The handover reuses
ConnectionService's outage handling and itsprobeUrlorigin probe, which the address-change flows already use, rather than extendingSystemService's own wait loop. - It probes the origin rather than
system.infobecause every RPC,system.infoincluded, needs this tab's encrypted session. Firmware with a different session protocol may not accept that session, while the origin probe only needs an HTTP answer. canStartUpdate()(not updating and not unreachable) is the single rule behind both the button and the refusal. It ignores the reboot wait, when the blocking progress dialog already covers the button.
Tradeoffs
- After the reload, the user sees the version the router reports but no "Updated to" or "Update failed" message. The author tried a verdict and removed it: a router that answers while still downloading reports the old version, so a working update would have been called failed. A correct verdict needs the router to report an update in progress.
- The origin may never answer again, for example when the update changed a Remote Access WAN address. Then the notice and the disabled button stay until the user reloads or navigates away. Unlike
reconnectAt, this handover has no fallback that forces navigation after a time limit.
Screenshots are in the comment that follows this review, captured from this head.
Testing
- The author's run on ae4b2a8 (the head without the docs-only merge):
- The author's K1 bench run. The build also carried open #4939, which changes the shared session transport and touches none of these files. A stand-in registry offered an update whose download never answers, and the UI tunnel was dropped.
- Before the fix, the notice appeared at +318 s and turned generic 4 s after switching to Devices.
- After it, "Update now" was disabled from +317 s, and the explanation stayed on Devices for the 74 s until the router came back. The page reloaded 4 s later with no outcome toast, and
bench.sh smokepassed. - The refusal copy, the shared
canStartUpdate(), the tests and the comments changed after the bench run.
- My screenshot capture, not a test run. I used a development build of this head's StartWRT UI with the mock backend in headless Chromium, with timers fast-forwarded. Every RPC after
system.updatefailed as a network error and the origin probes were refused. I then clicked "Update now".- The handover came after the 60th failed attempt. The dialog closed, the notice showed the explanation, and "Update now" was disabled.
- On Devices, the explanation stayed through 20 s of failed background polls.
- Once the probes could answer, the page reloaded.
- This ran the production code paths against a mock backend, not a firmware update.
- CI on 37e6817:
- Prettier, Formatting & Lockfiles, Changelog fragments & versions, Dependency Licenses and Conflict Markers pass.
- Still pending: "Build riscv64 binary" (
make start-wrt, which compiles this UI), "StartWRT Tests" and the other build and test jobs. - No CI job runs
npm run check:rpc-clients, which holds these regression tests, orcheck:i18n:wrt. The author's run above is their only record.
Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
|
Screenshots for the approval brief above (this head, 37e6817). |


After an update reboot, the update screen polls the router for several minutes (60 attempts, each a 5 s pause plus a probe of up to 5 s). When that ran out, it closed its progress dialog without a word, leaving a page that still showed the old version.
The path is reached when:
Found on the 1.5.0 release bench: the tab sat on "Device is restarting…" for about 5.8 minutes and then closed silently.
What changes
SystemService.pollForReconnectcloses the dialog and reports the outage toConnectionService. That service owns the "Reconnecting" indicator, which background pollers report into once the update releases its suppression.probeUrlcheck rather thansystem.info, because the session this tab speaks may be what the running firmware no longer accepts.reportUnreachable()used to set its message before its already-unreachable guard. The next report without options, such as aFormServicepoll on Devices, therefore replaced the explanation with "Trying to reach the router". It now sets the default message only when an outage starts, and a later report changes the message only when it carries one. Recovery resets everything for the next outage.reconnectAtwaits, so "Reconnecting to the new address…" became the generic text within a poll or two. It now stays until the page navigates.ConnectionService.unreachable(), andSystemService.startUpdaterefuses then as well. The progress dialog closes when the update cannot start, instead of spinning.SystemServicereaches sessionStorage and the window throughWA_SESSION_STORAGEandWA_WINDOW. The "Updated to v…" confirmation that ridesstartwrt.updated-toacross the in-wait reload works as on master.ConnectionServiceare trimmed and no longer assume every probe targets a new address. The progress dialog's doc says what it does. Comments in both services that assumed an update clears the session are removed.One limit remains: the indicator promises a reload that never happens if the origin never answers again, for example a Remote Access WAN address that changed during the update.
Verification on ae4b2a8
Merged master 316493c (docs only) after verification, without conflicts.
npm run check:rpc-clients: PASS, 108 tests. The regression tests fail on the commit before their fix:ConnectionServicethrough the handover and then an option-less report;completeWithwas never called.npm run check:wrtandnpm run build:wrt: PASS.node scripts/changelog.mjs check-version projects/start-wrt: PASS.canStartUpdate()):bench.sh smokePASS.canStartUpdate(), the tests and comments. Those changes are covered by tests and type-checked, but not benched.