sessions: navigate between chats in back/forward history#315626
Merged
Conversation
Track active chat changes within a session so that switching chats is recorded in navigation history. Back/Forward now restores the specific chat that was active at that point. - Add optional chatResource to INavigationEntry - Observe activeSession.activeChat in the autorun (reading before the _navigating guard to keep subscriptions alive) - Skip untitled chats from recording (consistent with untitled sessions) - _navigateTo calls openChat() when entry has a chatResource - _isSameEntry compares both session and chat resources - Add tests for intra-session chat navigation Fixes #315623 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
lszomoru
approved these changes
May 11, 2026
Contributor
|
This PR will be automatically cherry-picked to |
Contributor
There was a problem hiding this comment.
Pull request overview
Extends the Agents window’s SessionsNavigation history tracking so back/forward navigation restores not only the active session, but also the active chat within a multi-chat session (fixing #315623).
Changes:
- Added optional
chatResourceto navigation entries and record history onactiveSession.activeChattransitions (skipping untitled chats). - Updated navigation to open a specific chat via
openChat(session, chatUri)when the history entry includes a chat resource. - Expanded
sessionNavigation.test.tswith multi-chat stubs and new coverage for intra-session chat navigation.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/services/sessions/browser/sessionNavigation.ts | Records chat-level navigation in history and restores chats on back/forward. |
| src/vs/sessions/services/sessions/test/browser/sessionNavigation.test.ts | Adds test scaffolding and new tests covering chat-aware navigation history. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 2
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.
Summary
Extends the session back/forward navigation (#315382) to also track chat-level transitions within a session. Previously, switching between chats in a multi-chat session was not recorded in history.
Fixes #315623
Changes
sessionNavigation.tsINavigationEntrynow includes an optionalchatResource: URIalongsidesessionResourceactiveSession.activeChatin addition toactiveSession, reading both before the_navigatingguard to keep subscriptions alive_navigateTocallsopenChat(session, chatResource)when the entry has achatResource, otherwise falls back toopenSession()_isSameEntrycompares bothsessionResourceandchatResourcesessionNavigation.test.tsstubChatWithId()helper for creating chat stubs with unique IDsstubSession()to accept optionalchatsparameterMockSessionStorewithsetActiveChat()andopenChat()support, trackinglastOpenedChatResourcegoBackrestores previous chat within a session