Skip to content

Await Copilot session teardown before config refresh - #327126

Merged
Ulugbek Abdullaev (ulugbekna) merged 1 commit into
microsoft:mainfrom
ulugbekna:ulugbekna/investigate-holder-termination
Jul 23, 2026
Merged

Ulugbek Abdullaev (ulugbekna) merged 1 commit into
microsoft:mainfrom
ulugbekna:ulugbekna/investigate-holder-termination

Conversation

@ulugbekna

Copy link
Copy Markdown
Contributor

Fixes #327125

A structural active-client configuration change refreshes the default Copilot chat by disposing and resuming its SDK session. Disposal previously started session.disconnect() without awaiting it, allowing the stale session.destroy request to terminate the newly resumed session with the same ID. The next turn then failed with Holder terminated during creation.

This change awaits the existing session teardown before clearing and resuming the default chat. Peer chats remain intact. A deterministic regression test holds disconnect open and verifies that dispose, resume, and send occur only after teardown completes.

Testing:

  • npm run typecheck-client
  • npm run valid-layers-check
  • scripts/test.sh --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts
  • hygiene checks

cc Connor Peet (@connor4312)

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 6a07710e-3e11-4636-999a-11986503b6cb
Copilot AI review requested due to automatic review settings July 23, 2026 13:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Ensures Copilot configuration refreshes fully disconnect the existing SDK session before resuming the same session ID, preventing stale teardown from terminating the replacement session.

Changes:

  • Await SDK session destruction before clearing and resuming the default chat.
  • Add deterministic regression coverage for teardown, disposal, resume, and send ordering.
Show a summary per file
File Description
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Awaits session teardown during configuration refresh.
src/vs/platform/agentHost/test/node/copilotAgent.test.ts Verifies refresh waits for disconnect completion.

Review details

  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Medium

@ulugbekna
Ulugbek Abdullaev (ulugbekna) merged commit 3d97fea into microsoft:main Jul 23, 2026
29 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.131.0 milestone Jul 23, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Sep 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agents window config refresh can terminate a newly resumed Copilot session

3 participants