Repository navigation
Restore the active canvas after a folder location swap - #350127
Merged
Sandeep Somavarapu (sandy081) merged 3 commits intoNov 24, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Canvas state handling can overwrite the wrong location’s saved activation during queued or failed folder changes and ignore destination activation preferences when a canvas remains suspended.
2 open issues
What changed in this PR
Addresses #349766 by remembering canvas tab activation across Folder Location switches in single-folder editor windows. The Agents window restoration path remains unchanged.
Changes:
- Tracks activation per canvas and folder location, retaining up to 20 locations.
- Adds restoration handling for first visits and failed-apply fallbacks, and clears remembered state when a canvas closes.
- Adds regression tests and updates test harness dependencies.
| File | Description |
|---|---|
src/vs/workbench/contrib/canvases/test/electron-browser/canvasService.test.ts |
Tests activation restoration, fallbacks, retention limits, and close/reopen behavior. |
src/vs/workbench/contrib/canvases/electron-browser/canvasService.ts |
Records and restores per-location canvas activation. |
src/vs/sessions/contrib/canvases/test/electron-browser/sessionCanvasService.test.ts |
Supplies the new constructor dependencies in the Agents window test harness. |
Review effort: Balanced
Aiday Marlen Kyzy (aiday-mar)
previously approved these changes
Nov 24, 2026
A window without working sets of its own (the editor window) closes a canvas while it applies a folder location working set, then reopens it once the swap is done. Only the Agents window path recorded whether the canvas was the active tab, so the editor window always brought it back as a background tab. Remember, per folder location, whether each canvas was the active tab when the window leaves that location. On return, restore the state recorded for it; on a first visit, carry over the state from the location just left. The memory is bounded and dropped when the canvas closes. Fixes #349766 Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081)
force-pushed
the
agents/canvas-restores-active
branch
from
November 24, 2026 14:42
544dc98 to
06046a9
Compare
Ladislau Szomoru (lszomoru)
previously approved these changes
Nov 24, 2026
A canvas that is not open during a folder location swap, because its owner is hidden, records nothing but is now restored as the location being entered remembers it. Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081)
dismissed stale reviews from Ladislau Szomoru (lszomoru) and Aiday Marlen Kyzy (aiday-mar)
via
November 24, 2026 15:19
5e16739
Ladislau Szomoru (lszomoru)
previously approved these changes
Nov 24, 2026
Vritant Bhardwaj (vritant24)
previously approved these changes
Nov 24, 2026
Ben Villalobos (benvillalobos)
previously approved these changes
Nov 24, 2026
Connor Peet (connor4312)
previously approved these changes
Nov 24, 2026
Connor Peet (connor4312)
left a comment
Member
There was a problem hiding this comment.
No blocking findings. Two P2 correctness issues are noted inline.
Written by Connor's agent running GPT-6.1 Sol
…older location change Source control working sets apply without changing the folder location; a canvas must not take over the editor they restore as the active one. Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081)
dismissed stale reviews from Connor Peet (connor4312), Ben Villalobos (benvillalobos), Vritant Bhardwaj (vritant24), and Ladislau Szomoru (lszomoru)
via
November 24, 2026 21:56
e3ef73a
Dmitriy Vasyura (dmitrivMS)
approved these changes
Nov 24, 2026
Ben Villalobos (benvillalobos)
approved these changes
Nov 24, 2026
Sandeep Somavarapu (sandy081)
deleted the
agents/canvas-restores-active
branch
November 24, 2026 22:47
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #349766
In a single-folder editor window with worktrees, a canvas that was the active tab came back as a background tab after switching Folder Location to a worktree and back. The editor window closes canvases while it applies a folder location working set and reopens them afterwards, but only the Agents window path recorded whether a canvas was the active tab.
Changes
CanvasServiceremembers, per folder location, whether each canvas was the active tab when the window leaves that location.How to test
chat.editorWindow.enableWorktreeon and a worktree.Validation:
./scripts/test.sh --runGlob "**/canvases/test/**/*.test.js": 282 passing (new tests: issue round trip, neighbor, first visit, same location, failed apply then empty fallback, 20-location limit, closed while shown elsewhere; the failed-apply and neighbor tests fail without the fix)../scripts/test.sh --runGlob "**/contrib/workspaces/test/**/*.test.js": 87 passing../scripts/test.sh --run src/vs/workbench/test/browser/parts/editor/editorPartsWorkingSet.test.ts: 4 passing.pnpm run oxlint <changed files>andpnpm run typecheck-client: passed.Written by GitHub Copilot on behalf of Sandeep Somavarapu (@sandy081)