Skip to content

Update session replacement logic to ensure active session wrapper reflects committed session#318884

Draft
DonJayamanne wants to merge 1 commit into
mainfrom
don/innocent-lizard
Draft

Update session replacement logic to ensure active session wrapper reflects committed session#318884
DonJayamanne wants to merge 1 commit into
mainfrom
don/innocent-lizard

Conversation

@DonJayamanne
Copy link
Copy Markdown
Contributor

@DonJayamanne DonJayamanne commented May 29, 2026

Fixes #318883

Copilot AI review requested due to automatic review settings May 29, 2026 01:56
@DonJayamanne DonJayamanne self-assigned this May 29, 2026
// Rewrite the visible wrapper so consumers of the active session observe
// the committed session object. This matters even when the provider keeps
// the same session id for the untitled -> committed transition.
this._visibility.updateSession(from, to);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sandy081 @benibenj Not sure whether the changes are correct
Tagging you as this reverts the chagnes you have made
I"m not confident of this new change not breaking anything else,

@lszomoru tagging you as you might have a better fix/ideas

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes session replacement handling in the Agents window so that when a provider replaces an “untitled” session with its committed form without changing the session id, the active session wrapper is rebuilt to point at the committed ISession object. This addresses issue #318883 where UI surfaces (e.g. “Branch Changes”) could stay empty until navigating away/back because they were still observing the stale session instance.

Changes:

  • Route provider onDidReplaceSession handling through VisibleSessions.updateSession(from, to) to rebuild the wrapper even when from.sessionId === to.sessionId.
  • Add a regression test asserting that same-id replacement updates both activeSession and visibleSessions wrappers.
Show a summary per file
File Description
src/vs/sessions/services/sessions/browser/sessionsManagementService.ts Uses VisibleSessions.updateSession during session replacement so the active/visible wrappers reflect the committed session object even when ids don’t change.
src/vs/sessions/services/sessions/test/browser/sessionsManagementService.test.ts Adds a regression test covering same-id replacement updating the active session wrapper and visible sessions wrapper.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@sandy081 sandy081 added this to the 1.124.0 milestone Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Branch Changes is empty when creating a new Copilot Agent Host Session with chagnes

4 participants