Frontmatter
| id | 8694 |
| title | Service Worker: Robust Version Synchronization (Boot Check & 404 Recovery) |
| state | Closed |
| labels | enhancementaicore |
| assignees | tobiu |
| createdAt | Jan 16, 2026, 5:39 AM |
| updatedAt | Jan 16, 2026, 5:45 AM |
| githubUrl | https://github.com/neomjs/neo/issues/8694 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 16, 2026, 5:45 AM |
Service Worker: Robust Version Synchronization (Boot Check & 404 Recovery)

tobiu
Jan 16, 2026, 5:45 AM
Input from Gemini 3 Pro:
✦I have implemented the robust version synchronization strategy.
Changes Implemented:
Boot-Time Version Check (
src/main/addon/ServiceWorker.mjs):
- Upon establishing a connection with the Service Worker, the client now queries the SW version (
getVersionaction).- If a mismatch is detected (
Client.version !== SW.version), the client immediately triggerslocation.reload(true)to fetch fresh assets. This prevents the "Zombie App" state at the earliest possible moment.Runtime 404 Recovery (
src/worker/ServiceBase.mjs):
- Implemented
on404(event)handler inServiceBase.- Updated
onFetchto invokeon404when a request returns status 404.- Configured to guard critical paths:
/dist/production/,/dist/esm/, and/src/.- If a 404 occurs on these paths, the SW sends a
remoteMethodmessage toNeo.Main.reloadWindowwithforce: true.- Added a 5-second throttle (
lastReload) to prevent infinite reload loops in case of persistent server errors.Core Support (
src/Main.mjs):
- Updated
Neo.Main.reloadWindowto accept a{force: true}parameter, which maps tolocation.reload(true).Outcome: Users encountering a version mismatch (either at boot due to stale index, or mid-session due to an update) will now experience a single automatic hard reload instead of a crash or blank page. The system is protected against infinite loops.
tobiu closed this issue on Jan 16, 2026, 5:45 AM
tobiu assigned to @tobiu on Jan 16, 2026, 5:45 AM
To strictly enforce version synchronization between the Client (App/Main) and the Service Worker, ensuring users never get stuck in a "Zombie" state (Old App + New SW + Deleted Assets):
Boot-Time Version Check:
ServiceBaseto handlegetVersionmessage.main.addon.ServiceWorkerto query the SW version upon connection.Client.version !== SW.version, trigger immediatelocation.reload(true).Runtime 404 Recovery (Safety Net):
ServiceBase.onFetchto intercept 404s on guarded paths (dist/production, etc.).Neo.Main.reloadWindow({force: true})to the client.This two-pronged approach ensures: