Bugfix: How to fix extension auto-fallback and environment switching...

Documentation for Sessions

🐛 Bugfix: How to fix extension auto-fallback and environment switching...

Date: 2026-02-28
Time: 17:16:03 UTC
Session: gspace1-153.2
Agent: storage
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

How to fix extension auto-fallback and environment switching being dead code

Task: Not specified


🎯 Decision Made

Chosen:

Wire checkLocalAndFallback() in activation flow, add switchEnvironment handler in main-panel.ts, fix drain abort logic in pending-queue

Options Considered:


💭 Reasoning

The previous agent implemented the auto-fallback logic (checkLocalAndFallback method) and the environment toggle UI (settings-view switchEnvironment) but never wired them to the activation flow or message handler. Extension showed 'Disconnected' instead of falling back to production. Fixed by: 1) calling checkLocalAndFallback() on health check failure in extension.ts, 2) adding switchEnvironment case to main-panel handleMessage switch, 3) fixing drain() to abort after 3 consecutive failures instead of clearing queue upfront, 4) using STORAGE_DIR for mode persistence instead of hardcoded .cursor path, 5) proper ConnectivityManager type instead of any.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation