You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ClineProvider.getState() reports shared state instead of the view's own hydrated per-view selections #1549
ClineProvider.getState() reads every state field directly from the shared ContextProxy (global extension state). Per-view selections held in the provider's view-local buffer (viewLocalState: mode, currentApiConfigName, apiConfiguration) are hydrated per webview from the durable viewStates map, but getState() never merges that buffer in — so every webview reports the same shared mode / API profile / provider configuration regardless of what that view actually selected.
Extension-side consumers of getState() therefore see the wrong mode / profile / apiConfiguration when multiple views hold different selections: a per-view mode or profile switch does not take effect for the view that made it, and provider settings reported for a view can belong to another view's selection.
Expected behavior
getState() should serve each per-view-capable field from the view's hydrated state when that view has a selection, falling back to the shared global value otherwise (view-local wins; fields the view has not selected are unchanged, with the existing defaults).
Proposed fix
In getState(), merge the view-local buffer on top of the context values before reading the state fields:
and read the per-view fields (including the apiConfiguration object, merged over the provider settings) from mergedStateValues. The write path already drops unknown modes and keeps the buffer consistent (validation on setValues / setValue), so the read path stays a pure merge with no new validation.
Reproduction
Create two ClineProvider instances over the same extension context (e.g. sidebar + editor webviews).
On each, save a per-view selection (mode, currentApiConfigName, or apiConfiguration) via the view-state save path.
Call getState() on both instances.
Both return the shared global values — the per-view selections are not reflected in the reported state.
Activity