Problem
PR #966 introduced per-view state isolation (viewLocalState buffer), but this state is stored only in memory. On extension reload, all view-specific values are lost and fall back to shared global defaults.
This creates a "quiet reset" — worse than not having the feature at all:
- User opens tab A → selects mode
architect, API config my-profile
- Extension reloads (e.g., VS Code restart, extension update)
- Tab A restores with shared global values (e.g., mode
default, API config roo-code)
- User sees stale/wrong state without any indication that a reset occurred
Current Architecture
User Action → viewLocalState[key] = value (in-memory buffer only)
↓
No write to durable storage
↓
Extension Reload → viewLocalState cleared → fallback to global defaults
loadViewState() reads from contextProxy.globalState, but per-view keys (__view_state_{id}_mode) are not included in GLOBAL_STATE_KEYS, so they're never restored.
Impact
| Scenario |
Before PR #966 |
After PR #966 (current) |
| Single tab, no reload |
✅ Works |
✅ Works |
| Parallel tabs, no reload |
✅ Independent state |
✅ Independent state |
| Extension reload |
N/A (no per-view state) |
❌ Stale values — worse than before |
Proposed Fix
Store per-view state in vscode.workspaceState (or a dedicated durable key in contextProxy.globalState) so that:
- View-specific mode/API config survives extension reload
loadViewState() can restore the correct values on startup
- Parallel tabs maintain independent persistent state across restarts
Related
Problem
PR #966 introduced per-view state isolation (
viewLocalStatebuffer), but this state is stored only in memory. On extension reload, all view-specific values are lost and fall back to shared global defaults.This creates a "quiet reset" — worse than not having the feature at all:
architect, API configmy-profiledefault, API configroo-code)Current Architecture
loadViewState()reads fromcontextProxy.globalState, but per-view keys (__view_state_{id}_mode) are not included inGLOBAL_STATE_KEYS, so they're never restored.Impact
Proposed Fix
Store per-view state in
vscode.workspaceState(or a dedicated durable key incontextProxy.globalState) so that:loadViewState()can restore the correct values on startupRelated