Architecture: How to fix environment switching bugs in VSCode extension an...

Documentation for Sessions

🏗️ Architecture: How to fix environment switching bugs in VSCode extension an...

Date: 2026-02-28
Time: 18:59:39 UTC
Session: gspace1-154.2
Agent: architecture
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

How to fix environment switching bugs in VSCode extension and align both extensions

Task: Session 154: Improve extensions - fix bugs and align features


🎯 Decision Made

Chosen:

Fix detectEnvironment() to derive backendUrl from environment setting, add environment to config response, add DEV_ACCESS_KEY to VSCode, simplify backendUrl to production vs dev+port in both extensions, add auto-fallback to Chrome extension

Options Considered:

  1. Fix bugs only, keep current architecture
  2. Fix bugs + simplify backend URL model in both extensions
  3. Full rewrite of environment handling in both extensions

💭 Reasoning

Root cause of VSCode bug: detectEnvironment() passes through raw VSCode backendUrl setting instead of deriving it from the isDev flag. When user switches to production, isDev=false but backendUrl stays as localhost:3001. Also settings-view.ts never receives the current environment setting from the extension. Chrome extension has solid DEV_ACCESS_KEY pattern that should be mirrored in VSCode to gate dev settings. Full backendUrl override is over-engineering — only 2 real scenarios: production (always gograb.space) and dev (always localhost:port).


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation