Skip to content

[BUG] Isolate parallel mode and provider profile writes (vps2 F3; upstream #978) #1559

Description

@easonLiangWorldedtech

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

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)

  1. 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.
  2. src/core/task/Task.ts (+ Task.spec.ts) — the task-side per-view mode/profile write port.
  3. src/core/tools/SwitchModeTool.ts (+ switchModeTool.spec.ts) — the tool-side per-view write port.
  4. 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).
  5. 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.
  6. src/core/webview/tests/ClineProvider.spec.ts — the two handleModeSwitch assertion-rewrite hunks.
  7. src/core/webview/tests/ClineProvider.parallelMode.spec.ts — the F3 describes appended to the file created by F2, plus F3-authored mutation-killing tests.
  8. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions