Skip to content

fix(webview): invalidate live sibling view state on reset and settings import (vps2 F4) - #1562

Open
easonLiangWorldedtech wants to merge 288 commits into
Zoo-Code-Org:mainfrom
easonLiangWorldedtech:vps2/f4-cross-instance-reset
Open

easonLiangWorldedtech wants to merge 288 commits into
Zoo-Code-Org:mainfrom
easonLiangWorldedtech:vps2/f4-cross-instance-reset

Conversation

@easonLiangWorldedtech

@easonLiangWorldedtech easonLiangWorldedtech commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Draft PR — vps2 unit F4 (cross-instance reset and import invalidation). Each view's per-view state follows the profile that view actually uses.

Rewritten 2026-11-20 against head 0c8383486aeb; the body it replaced is verbatim in the lane file pr1562-scratch/r13-chronicle.md.

Related GitHub Issue

Closes: #1561 - by content, not by label: it records the per-view state bug this unit fixes. #2488 stays open with the write-ownership decision this unit does not settle.

Description

A view holds the profile it uses and the state that belongs to it. Every path that moves a profile must move the state with it.

  • src/core/webview/ClineProvider.ts - owner of per-view state. A reset calls broadcastResetToAllInstances after the shared reset lands, and again when it fails after already writing; every live view clears its own state, durable entries included. A save refreshes pinned views, a deletion re-pins the views that named the deleted profile, a rename re-points them, and a view in teardown stays out of the fan-outs.
  • src/core/config/ContextProxy.ts - durable store for the per-view records.
  • src/core/config/ProviderSettingsManager.ts, src/core/config/importExport.ts - profile lookup, and the import that calls the same broadcast.
  • src/core/webview/webviewMessageHandler.ts - messages that switch mode or profile, rename a profile, or start an import.
  • src/extension/api.ts - API facade: events and calls that carry the view id and profile name; the rollback log names keys, not credential values.
  • src/core/task/Task.ts, src/core/tools/SwitchModeTool.ts - switches from inside a task; a failed switch keeps the old mode and still delivers the message.
  • src/activate/registerCommands.ts - command wiring for a second extension instance.
  • webview-ui/src/utils/vscode.ts, webview-ui/src/context/ExtensionStateContext.tsx - webview state wrapper and cache; a read that throws after every write landed returns the in-memory state.
  • packages/types/src/global-settings.ts, packages/types/src/vscode.ts, packages/types/src/vscode-extension-host.ts - the setting, its validation, and the state posted to the webview.
  • 19 test files, one group per file above, including ClineProvider.spec.ts and api-configuration.spec.ts.
  • src/eslint-suppressions.json, src/package.json, .gitignore - tooling lines.

Budget, read from the server on 2026-11-20: 36 files, +23,573 and -1,702 against main 5ba06451e0f2; 19 files are tests (+19,127, -1,215), 17 are production or tooling (+4,446, -487). Residual unchanged: a failed live-pair check leaves the durable half; finding D-1 decides which side wins.

How to test

  • Provider spec: node node_modules/vitest/vitest.mjs run core/webview/__tests__/ClineProvider.spec.ts in src/.
  • Extension-host suite: node node_modules/vitest/vitest.mjs run in src/.
  • Webview suite: node node_modules/vitest/vitest.mjs run in webview-ui/.
  • Typechecks: tsc --noEmit -p . in src/ and webview-ui/; tsc --noEmit -p tsconfig.esm.json in apps/vscode-e2e/.
  • Lint: eslint <file> --max-warnings=0 --no-warn-ignored, then eslint --prune-suppressions --max-warnings=0 on the touched files; restore src/eslint-suppressions.json.
  • Format: prettier --check on the touched files.
    Commands run from the package directory; run numbers live in the lane record.

State and blocker

  1. Verdict CHANGES_REQUESTED - newest review 5999967983, 2026-11-20 22:01:03Z; 183 threads, 76 open, 26 without an answer (read 22:31 UTC).
  2. Checks: all six required contexts green at head 0c8383486aeb; comment 7051452544 names them.
  3. Advisory gate, jobs 136576149686 and 136598813266: Mutation gate failed: extension has 2631 changed executable lines (limit 500). Not required for merge; needs a human choice - split, or a narrow exclusion.
  4. No conflicts: main 5ba06451e0f2 is the head's second parent. mergeable_state: blocked is the review gate, not a merge conflict.

Pre-Submission Checklist

Visual Snapshots, Videos, Documentation

None: no rendered, interaction, or documentation change. Comment on this pull request, or reach easonLiangWorldedtech.

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

Labels

awaiting-author PR is waiting for the author to address requested changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Invalidate per-view state after reset and settings import (vps2 F4; upstream #980)

2 participants