Skip to content

Add session restore coalescing and error handling in AgentService#322022

Merged
DonJayamanne merged 1 commit into
mainfrom
don/crucial-guineafowl
Jun 19, 2026
Merged

Add session restore coalescing and error handling in AgentService#322022
DonJayamanne merged 1 commit into
mainfrom
don/crucial-guineafowl

Conversation

@DonJayamanne

Copy link
Copy Markdown
Contributor

For #320303

Copilot AI review requested due to automatic review settings June 18, 2026 23:49
@DonJayamanne DonJayamanne self-assigned this Jun 18, 2026

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

This PR improves Agent Host session restoration performance and reliability by preventing duplicate concurrent restore work (especially expensive session catalog refreshes) and by hardening restore error handling. It directly targets the “Switching sessions is too slow” scenario by ensuring repeated restores/subscribes for the same session (including subagent sessions) share the same in-flight restore work.

Changes:

  • Coalesce concurrent restoreSession() calls for the same session URI so only one backend restore is performed at a time.
  • Coalesce concurrent restores for the same subagent session URI during subscribe/restore flows.
  • Add unit tests covering coalescing behavior and ensuring failed restores don’t permanently block retry.
Show a summary per file
File Description
src/vs/platform/agentHost/node/agentService.ts Adds in-flight restore tracking for sessions and subagent sessions to avoid duplicated restore work and to ensure in-flight entries are cleared after completion/failure.
src/vs/platform/agentHost/test/node/agentService.test.ts Adds restore concurrency and retry tests for both normal and subagent session restore paths.

Copilot's findings

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

@DonJayamanne

Copy link
Copy Markdown
Contributor Author

@roblourens /cc

@DonJayamanne DonJayamanne marked this pull request as ready for review June 19, 2026 00:09
@DonJayamanne DonJayamanne enabled auto-merge (squash) June 19, 2026 01:53
@DonJayamanne DonJayamanne merged commit 3d97707 into main Jun 19, 2026
26 checks passed
@DonJayamanne DonJayamanne deleted the don/crucial-guineafowl branch June 19, 2026 03:36
@vs-code-engineering vs-code-engineering Bot added this to the 1.126.0 milestone Jun 19, 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.

3 participants