Repository navigation
Description
Original Request
Dashboard service worker masks TLS certificate errors with cached HTML, then produces a blank page when asset fetches and cache fallbacks fail
Summary
The dashboard service worker can hide an HTTPS loading failure by returning cached HTML whose required JavaScript and CSS are unavailable. Its asset fallback then resolves to undefined, leaving a blank page and obscuring the underlying failure instead of presenting a useful error.
Current Behavior
- Worker installation precaches
./and./manifest.webmanifest, but not the application's JS/CSS. A successful first load can therefore leave a cached HTML shell without cached application assets. - On a failed navigation fetch, the worker serves cached HTML without establishing that its required assets can load.
- On a failed static-asset fetch, the handler uses
fetch(req).catch(() => caches.match(req)). If the cache lookup misses, the promise passed torespondWith()resolves toundefined. - The browser displays a blank page and service-worker errors. A TLS failure that would otherwise be visible during navigation can be hidden behind the cached shell.
Reproduction verified in isolated Firefox
Tested with Firefox 154.0 against the running native-HTTPS dashboard, without changing dashboard code or configuration:
- Use a fresh browser origin/profile and temporarily bypass certificate validation through browser automation. Load the dashboard through a loopback address that does not match the certificate's hostname.
- Allow worker installation to finish. The dashboard loads successfully; its worker cache contains the HTML and manifest, but no JS/CSS.
- End that automation session and begin a new session with certificate validation enabled. Keep the worker and caches intact.
- Reload the same origin. The worker returns cached HTML, but JS/CSS requests fail and have no cached responses. The page is blank.
Sanitized error example:
Failed to load 'https://localhost:<dashboard-port>/assets/app-HASH.js'.
A ServiceWorker passed a promise to FetchEvent.respondWith()
that resolved with non-Response value 'undefined'.
A separate direct request in the controlled reproduction exposed SSL_ERROR_BAD_CERT_DOMAIN; the worker-mediated asset requests instead exposed NS_ERROR_INTERCEPTION_FAILED and the invalid-response errors.
In the original incident, localhost was first opened after an earlier certificate rotation, with an exception for the previous certificate. Clearing that origin's site data and establishing trust for the current certificate restored access. The original low-level fetch error was not retained, so the controlled reproduction—not an invented original network trace—is the evidence for the TLS failure mechanism.
Proposed Behavior
Handle failed navigations and asset cache misses so a cached shell cannot turn an underlying loading failure into an unexplained blank page. Preserve a useful failure path: either the browser's normal loading-error flow or a standalone visible error that does not depend on unavailable application JS/CSS.
Do not require the worker to identify a specific certificate error: browser fetch() may expose only a generic network failure.
Acceptance Criteria
- With cached navigation HTML present but required JS/CSS unavailable after a TLS/network fetch failure, loading produces a visible failure rather than an unexplained blank application page.
- A failed asset fetch followed by a cache miss never causes the promise passed to
FetchEvent.respondWith()to resolve toundefined.
Context
- PWA introduction: Dashboard PWA: service-worker notifications + installable app #329
- The mobile Android Tailscale DNS failure investigated alongside this incident was separately recovered by restarting the Tailscale app process. It is not a requested change in this issue.
Technical Notes
- Worker implementation:
packages/dashboard/src/client/public/sw.js. - Existing handler tests:
packages/dashboard/test/sw-handler.test.ts. Navigation test B6 expects cached-shell fallback; asset test E4 covers a cache hit after network failure, but not the cache-miss/blank-page case. - Relevant browser/static-serving coverage:
packages/dashboard/test/pwa.test.ts. - Product context:
packages/coding-agent/docs/dashboard.mddescribes a live dashboard, not a full offline application. - Merely returning an error response for a missing script is insufficient if the navigation still delivers an HTML shell with no executable application; verify the visible page outcome.
- This issue does not request changes to certificate verification, certificate renewal, Tailscale DNS configuration, pairing, or additional offline functionality.
Activity