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 return outside the if (_isAutoFallback) block to always exit early when res.ok is true, preventing false fallback activation

Options Considered:


💭 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


🔗 Related


Auto-generated by MCP Smart Consolidation