Bugfix: Service worker checkLocalAndFallback incorrectly triggers pr...
Documentation for Sessions
🐛 Bugfix: Service worker checkLocalAndFallback incorrectly triggers pr...
Date: 2026-03-01
Time: 02:35:22 UTC
Session: gspace1-158.4
Agent: backend
Confidence: 98%
Status: ✅ Documented
📋 Decision Context
Question:
Service worker checkLocalAndFallback incorrectly triggers production fallback when localhost IS healthy
Task: Fix service worker idempotency bug found by tests
🎯 Decision Made
Chosen:
Moved
returnoutside theif (_isAutoFallback)block to always exit early whenres.okis true, preventing false fallback activation
Options Considered:
- No alternatives documented
💭 Reasoning
Idempotency test discovered the bug: when fetch succeeds (res.ok=true) but _isAutoFallback=false, the code fell through to the fallback block where !_isAutoFallback && ExtensionEnv.isLocalMode was true, incorrectly activating production fallback on a healthy localhost. Fix: if (res.ok) { if (_isAutoFallback) { restore... } return; } — the return is unconditional on res.ok.
📁 Files Involved
apps/vitto-chrome-extension/background/service-worker.js
🔗 Related
- Decision ID:
dev_1772332518738_k86hyiu - Session: 158
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation