sessions: fix observable tracking and stale chat validation in navigation#315638
Merged
Conversation
…hat exists - Read session.status and chat.status before the _navigating early return so the autorun keeps tracking status transitions during navigation - Validate chat still exists in session.chats before calling openChat; fall back to openSession when the chat was deleted Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
This PR will be automatically cherry-picked to |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR is a follow-up to session chat navigation history work, addressing observable dependency tracking during back/forward navigation and preventing navigation to stale/deleted chats.
Changes:
- Ensures
activeSession.statusandactiveChat.statusare read before the_navigatingearly return to keep autorun dependency tracking intact during navigation. - Adds validation that a
chatResourcestill exists insession.chatsbefore callingopenChat(), otherwise falls back toopenSession().
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/services/sessions/browser/sessionNavigation.ts | Fixes observable tracking during navigation and adds a stale-chat existence check before opening a chat from history. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 2
Verify that goBack falls back to openSession when the target chat was deleted from the session after being recorded in history. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
chrmarti
approved these changes
May 11, 2026
sandy081
added a commit
that referenced
this pull request
May 11, 2026
…tion (#315638) * sessions: read all observables before navigating guard and validate chat exists - Read session.status and chat.status before the _navigating early return so the autorun keeps tracking status transitions during navigation - Validate chat still exists in session.chats before calling openChat; fall back to openSession when the chat was deleted Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: add test for stale chat fallback in navigation Verify that goBack falls back to openSession when the target chat was deleted from the session after being recorded in history. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
sandy081
added a commit
that referenced
this pull request
May 11, 2026
#315632) * [cherry-pick] sessions: navigate between chats in back/forward history * sessions: fix observable tracking and stale chat validation in navigation (#315638) * sessions: read all observables before navigating guard and validate chat exists - Read session.status and chat.status before the _navigating early return so the autorun keeps tracking status transitions during navigation - Validate chat still exists in session.chats before calling openChat; fall back to openSession when the chat was deleted Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * sessions: add test for stale chat fallback in navigation Verify that goBack falls back to openSession when the target chat was deleted from the session after being recorded in history. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: vs-code-engineering[bot] <vs-code-engineering[bot]@users.noreply.github.com> Co-authored-by: Sandeep Somavarapu <sasomava@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.
Follow-up to #315626 — addresses two review comments.
Fixes
1. Read all observables before
_navigatingguardactiveSession.statusandactiveChat.statuswere read after the_navigatingearly return. During navigation, the autorun would skip those reads and lose dependency tracking on status changes. NowsessionStatusandchatStatusare read upfront so the autorun keeps tracking status transitions (e.g. Untitled → Completed) even during navigation.2. Validate chat still exists before opening
_navigateTonow checks that thechatResourcestill exists insession.chatsbefore callingopenChat(). If the chat was deleted after being recorded in history, it falls back toopenSession()instead of trying to open a stale URI.