Repository navigation
[BUG] Isolate parallel mode and provider profile writes (vps2 F3; upstream #978) #1559
Description
Gap
At the base of record (upstream/main @ 0d937c0) plus the shipped F1-series and F2 heads, per-view mode and provider-profile writes are not isolated:
- A mode switch in one panel (handleModeSwitch) writes through the shared provider path, so a switch in a parallel tab can overwrite the mode another panel is displaying; the webview delete-path (deleteProviderProfile) does not repoint the persisted per-view view states to a surviving profile.
- loadViewState can re-pin a dead mode slug (a mode no longer in the active set) instead of validating against the live mode list.
- The SwitchModeTool task-side write and the webview-side write are not the same per-view write: they target different state slices, so the durable per-view selection and the live task mode can diverge.
Upstream provenance
- Upstream issue: [BUG] Isolate parallel mode and provider profile writes #978 ("[BUG] Isolate parallel mode and provider profile writes").
- Port source: the F1c-head-to-CS residual, cross-checked against upstream PR fix(webview): isolate parallel mode and provider profile writes #979 (fix(webview): isolate parallel mode and provider profile writes) — closed/superseded by the vps2 series; the [BUG] GPT-5.5 Codex uses incorrect context window #41 ledger names fix(webview): isolate parallel mode and provider profile writes #979 as the F3 port source.
Fix unit
vps2 F3 of the durable per-view state series (fork tracking issue easonLiangWorldedtech#41). Draft PR: #1560 (branch vps2/f3-mode-profile-writes, stacked on the F2 head aa0f3b1; head 8da5c6e) — #1560
Fix scope (10 files, 919 insertions / 65 deletions = a+d 984 measured vs the F2 head)
- src/core/webview/ClineProvider.ts — the webview delete-path (deleteProviderProfile + repointPersistedViewStates), loadViewState dead-mode-pin validation, and the handleModeSwitch profile-write isolation; the F1a-shipped setViewStateId guard is retained.
- src/core/task/Task.ts (+ Task.spec.ts) — the task-side per-view mode/profile write port.
- src/core/tools/SwitchModeTool.ts (+ switchModeTool.spec.ts) — the tool-side per-view write port.
- src/core/webview/tests/webviewMessageHandler.spec.ts — fix(webview): isolate parallel mode and provider profile writes #979 mock-field additions only (the production WMH.ts is unchanged: the residual's kimi hunk is CS-only divergence, not fix(webview): isolate parallel mode and provider profile writes #979 content).
- src/core/webview/tests/ClineProvider.sticky-mode.spec.ts — concurrent-switch assertions re-targeted from the shared mode key to the per-view viewStates key.
- src/core/webview/tests/ClineProvider.spec.ts — the two handleModeSwitch assertion-rewrite hunks.
- src/core/webview/tests/ClineProvider.parallelMode.spec.ts — the F3 describes appended to the file created by F2, plus F3-authored mutation-killing tests.
- src/eslint-suppressions.json — no-explicit-any counts decrease (ClineProvider.ts 12 to 11; sticky-mode spec 36 to 33); no increases.
Series note
Draft PR; this unit is the 5th of the merge chain (F1a to F1b to F1c to F2 to F3 to F4 to F5 to F6 to F7). The PR body documents the CS not-ported register, the port-fidelity verification, the budget measurement, and the mutation-diff gate. No Closes/Fixes/Resolves linkage — this issue is the series gap record for the unit.
Activity