Repository navigation
Open
Description
Summary
Coordinate viewStates read-modify-write operations across independent extension hosts. This is the explicit F2 follow-up deferred from PR #1921, under parent #1536.
ClineProvider.persistedViewStateWriteQueue is static within one extension-host process. Separate VS Code windows have separate queues but share extension global state. Two hosts can read the same map, update different entries, and write competing whole-map snapshots. The later write can remove the other host's mode or profile pin.
Required changes
- Provide a cross-host coordination or conflict-safe merge mechanism for the durable
viewStatesstore. - Read authoritative state inside that mechanism before applying and committing each mutation. A lock around a stale
ContextProxyorglobalStatecached read is not sufficient. - Evaluate the existing guarded-write/merge abstraction used by
safeWriteJson. Reuse the established file-safety layer where compatible, or document why another storage/coordination design is necessary. - Route saves, clears/reset, temporary-to-stable re-keying, pruning, profile re-pointing, and rollback through the same coordinated persistence boundary so no whole-map writer bypasses it.
- Preserve existing per-view isolation and persistence-failure behavior. Do not broaden this unit into unrelated profile-routing reconciliation between PR test(webview): F2a - profile-mutation state semantics and the mode-rollback guard #1919 and PR test(webview): ClineProvider parallelMode suite with viewStates pruning edges #1921.
Affected areas
src/core/webview/ClineProvider.ts:persistedViewStateWriteQueue,getPersistedViewStates,writePersistedViewStates, and all durableviewStatesmutations.src/core/config/ContextProxy.ts: global-state cache and persistence integration.- The existing
safeWriteJsonguarded-write/merge layer and focused cross-host regression coverage.
Acceptance criteria
- A deterministic regression uses two independent extension hosts or processes with independently stale caches against one durable store.
- Overlapping writes to different view IDs retain both entries and their mode/profile selections after reload.
- A host that starts with a stale cache reads authoritative state inside the coordination boundary and preserves another host's completed write.
- Clear/reset, re-key, prune, profile re-point, and compensation paths do not bypass coordination or overwrite unrelated committed entries.
- Write failures, coordination failures, and retry behavior are explicit and covered; failed operations do not leave phantom cached state or silently remove another host's entries.
- Existing same-host serialization and per-view restoration behavior remain covered.
References
- Parent: Persist per-view view-state identity and durable viewStates in ClineProvider #1536
- PR: test(webview): ClineProvider parallelMode suite with viewStates pruning edges #1921
- Review thread: test(webview): ClineProvider parallelMode suite with viewStates pruning edges #1921 (comment)
- Requested by: @easonLiangWorldedtech
The fork issue easonLiangWorldedtech/Zoo-Code#41 is a working series ledger, not the upstream parent. Upstream #41 is unrelated. This issue tracks a valid, unfixed limitation; filing it does not establish PR merge readiness.
Metadata
Metadata
Assignees
Labels
No labels
Activity