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
[BUG] No per-view durable state: every Zoo Code view shares one global mode/profile, and reset leaks across views #1547
Tracking series: vps2 durable per-view state ??easonLiangWorldedtech#41 (fix unit F1a). Fix: draft PR #1546 (this issue is the issue of record for that PR, created at PR-open time).
Summary
As of upstream/main @ 0d937c0, ClineProvider has no per-view state identity: every view (sidebar, "Open in editor" tab, popout panel) reads and writes the same global mode / currentApiConfigName / apiConfiguration keys, and nothing is persisted per view. State changes in one view are visible in every other view, and nothing is reliably rehydrated after a reload.
Shared global keys: mode, API profile and apiConfiguration live under single global keys; a second view shows (and edits) the sidebar's state.
No per-view durable record: there is no viewStates record keyed by view identity, so per-view state does not survive a reload.
Cross-view reset / restore leaks: resetState and history restore write the shared global mode, affecting other open views instead of only the acting view.
Wedge on unacknowledged posts: postMessageToWebview awaits the webview ack; a remounted or disposed page never acknowledges, so task-critical callers can wedge.
Impact
User state leaks across views (one view's mode change, reset or restore changes what every other view sees), per-view state does not survive reload, and a remounted webview can stall task-critical message flows.
Per-view identity: each ClineProvider owns a unique viewId (renderContext plus a monotonic counter) and registers a stable viewStateId for durable persistence; entries rekey from the temporary id to the stable id on registration.
Durable core: a viewStates map (new GLOBAL_STATE_KEYS entry) persisted through a serialized write queue (concurrent instances merge without lost updates), pruned to the newest 50 entries; __proto__ ids are rejected so a per-view entry can never be keyed through the Object.prototype setter.
View-local buffer (viewLocalState): saveViewState / loadViewState / getValues / setValue / setValues hold mode / currentApiConfigName / apiConfiguration (the non-secret subset) per view; persistence is awaited before a save is reported successful; unknown modes are ignored with a log and non-string modes pass through.
History restore falls back to the default mode view-locally instead of writing the shared global mode.
postMessageToWebview no longer awaits the webview ack.
resetState clears the view-local buffer and the view's persisted entry.
Activity