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:
- Fix bugs only, keep current architecture
- Fix bugs + simplify backend URL model in both extensions
- 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
apps/vitto-vscode-extension/src/services/config.service.tsapps/vitto-vscode-extension/src/panels/main-panel.tsapps/vitto-vscode-extension/src/panels/webview/components/settings/settings-view.tsapps/vitto-chrome-extension/shared/env-config.jsapps/vitto-chrome-extension/shared/dev-mode.jsapps/vitto-chrome-extension/options/options.js
🔗 Related
- Decision ID:
dev_1772305175885_l82u0ei - Session: 154
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation