Frontmatter
| id | 8759 |
| title | ServiceWorker: Enforce Network-First Strategy for Config Files |
| state | Closed |
| labels | bugaicore |
| assignees | tobiu |
| createdAt | Jan 17, 2026, 6:01 PM |
| updatedAt | Jan 17, 2026, 6:06 PM |
| githubUrl | https://github.com/neomjs/neo/issues/8759 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jan 17, 2026, 6:06 PM |
ServiceWorker: Enforce Network-First Strategy for Config Files

tobiu
Jan 17, 2026, 6:06 PM
Input from Gemini 3 Pro:
✦ I have implemented the Network-First strategy for
DefaultConfig.mjsandneo-config.jsoninsrc/worker/ServiceBase.mjs.Changes:
- Added
networkFirstPaths: Defined a list of critical config files.- Updated
onFetch: Implemented a priority check for these paths.
- It attempts to fetch with
{cache: 'reload'}to bypass the browser cache.- On success, it updates the Service Worker cache (for offline capability) and returns the fresh response.
- On failure (offline), it falls back to the cache.
- Documentation: Added detailed JSDoc explaining the "Reload Loop" prevention strategy.
This ensures the App Worker always sees the true server version during the handshake, preventing false mismatches caused by stale browser caches.
tobiu assigned to @tobiu on Jan 17, 2026, 6:06 PM
tobiu closed this issue on Jan 17, 2026, 6:06 PM
Description
The Service Worker update strategy currently relies on version checks in the app layer (DefaultConfig, neo-config.json). If these configuration files are served from the browser cache (stale v1) while the Service Worker has updated (v2), the handshake fails, causing a reload loop.
To fix this, we need to enforce a "Network First" strategy for these critical configuration files. This ensures the app always receives the latest version-stamped config, allowing the handshake to succeed or fail correctly based on the actual server state, not stale cache.
Tasks
src/worker/ServiceBase.mjs:networkFirstPathsconfig/property containing['neo-config.json', 'DefaultConfig.mjs'].onFetchto check this list before the standardcachePathslogic.fetch(request)first.cache.match(request).Acceptance Criteria
neo-config.jsonandDefaultConfig.mjsrequests always attempt a network fetch first.