Skip to content

[UX] Add telemetry/tooltip for view-local state persistence limitation #919

Description

@easonLiangWorldedtech

[UX] Add telemetry/tooltip for view-local state persistence limitation

Problem

viewLocalState is session-scoped — it persists across tab switches within the same extension host session, but falls back to shared global state on extension reload. This limitation is documented in code comments (ClineProvider.ts:436-442) but not visible to users, who may expect per-tab settings to survive extension restarts.

Evidence

Code locations:

  • ClineProvider.ts:436-442: PERSISTENCE NOTE comment explains view-specific keys are NOT in GLOBAL_STATE_KEYS
  • ContextProxy.ts:59-67: initialize() only loads declared GLOBAL_STATE_KEYS, not dynamic __view_state_* keys
  • No UI tooltip, settings page note, or telemetry tracking for this limitation

Reproduction:

1. Tab A (sidebar): mode = "architect", apiConfig = "my-profile"
2. These are saved to __view_state_sidebar-0_mode and __view_state_sidebar-0_apiConfiguration
3. User reloads extension host (Ctrl+Shift+P → Developer: Reload Window)
4. ContextProxy.initialize() loads only GLOBAL_STATE_KEYS (mode, currentApiConfigName from shared keys)
5. Tab A's view-local state falls back to shared global state — may show different mode/apiConfig
6. User is confused why their per-tab settings "disappeared" after reload

Root Cause

The design trade-off (session-scoped vs cross-session persistence) is clear in code but invisible to users:

  • View-specific keys (__view_state_{id}_*) are dynamic and not declared in GLOBAL_STATE_KEYS
  • On extension restart, ContextProxy.initialize() doesn't load these keys
  • Users have no way to know their per-tab settings are session-only

Proposed Fix

Option A: Dev tooltip in SettingsView (recommended for v1)

// In SettingsView.tsx, add info box near mode/apiConfig section:
<StandardTooltip>
    <InfoIcon className="w-4 h-4 text-vscode-descriptionForeground" />
    <TooltipContent side="right">
        <p className="text-xs">Per-tab settings are session-only and reset on extension reload.</p>
        <p className="text-xs mt-1">To persist across sessions, use the "Sync View State" button to push changes to global settings.</p>
    </TooltipContent>
</StandardTooltip>

Option B: Settings page note (for power users)

Add a section in SettingsView → About or Experimental tab:

## Per-Tab Settings Behavior

- **Session-scoped:** Mode, API config, and profile selections are stored per-tab and persist across tab switches within the same session.
- **Reload behavior:** On extension reload, per-tab settings fall back to shared global state. Use "Sync View State" to make changes persistent.
- **Future work:** Cross-session persistence via `vscode.workspaceState` or adding view-specific keys to `GLOBAL_STATE_KEYS`.

Option C: Telemetry tracking (for product insights)

Track how often users experience state loss after reload:

// In ClineProvider.ts, add telemetry event on loadViewState fallback:
if (!viewSpecificValue && sharedKeyValue !== undefined) {
    this.telemetryService.log('parallel_mode_state_fallback', {
        viewId: this.viewStateId,
        key: 'mode',  // or 'currentApiConfigName' / 'apiConfiguration'
        reason: 'extension_reload',
    })
}

Scope

  • Impact: Users who reload extension frequently (developers testing changes) — low frequency but high confusion when it happens
  • Risk: Low — adding tooltip/telemetry doesn't change behavior, just improves awareness
  • Priority: Low (informational, not blocking)

Design Considerations

  1. Tooltip placement: Next to mode selector or API profile dropdown in SettingsView
  2. Telemetry event name: parallel_mode_state_fallback with properties: viewId, key, reason
  3. User education: Link to documentation/wiki page explaining session-scoped vs global persistence
  4. Future enhancement: Consider adding a "Persist View State" command that writes view-local state to vscode.workspaceState for cross-session persistence

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions