Skip to content

Enhance session customization handling and simplify sync logic#317700

Open
DonJayamanne wants to merge 3 commits into
mainfrom
don/fix-agent-picker2
Open

Enhance session customization handling and simplify sync logic#317700
DonJayamanne wants to merge 3 commits into
mainfrom
don/fix-agent-picker2

Conversation

@DonJayamanne
Copy link
Copy Markdown
Contributor

Improve session customization management and state synchronization across agents. This update ensures that customizations are immediately available upon session creation, enhancing user experience. Additionally, refactor the synchronization logic for better clarity and efficiency.

Copilot AI review requested due to automatic review settings May 21, 2026 04:32
@DonJayamanne DonJayamanne self-assigned this May 21, 2026
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 improves how agent-host session customizations are surfaced and synchronized so that custom agents/customizations are available immediately when a session is created or restored (not only after the first message), and refactors parts of the sync flow to be clearer and more deterministic.

Changes:

  • Claim the active client earlier on session restore so the host can sync this client’s customizations into session state immediately.
  • Forward SessionState snapshots for “NewSession” into the provider’s cached state so the agent picker can see custom agents before the first message.
  • Ensure Copilot session customizations are read from a “settled” view (wait for initial discovery/sync), and publish initial customizations right after createSession.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts Updates tests to reflect the new “active client claimed on restore” behavior.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts Claims active client during session restore to unblock customization-derived agents on open.
src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts Adds coverage ensuring NewSession state forwarding populates picker custom agents pre-send and cleans up on dispose.
src/vs/sessions/contrib/providers/agentHost/browser/baseAgentHostSessionsProvider.ts Implements NewSession state forwarding into _lastSessionStates + cleanup sentinel; avoids duplicate writers on graduation.
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Adds “settled” customization snapshotting to avoid empty results during initial discovery/sync.
src/vs/platform/agentHost/node/agentService.ts Publishes initial session customizations after state creation so subscribers see custom agents immediately.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 1

Comment thread src/vs/platform/agentHost/node/agentService.ts
Co-authored-by: DonJayamanne <1948812+DonJayamanne@users.noreply.github.com>
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.

Copilot's findings

  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new

@DonJayamanne DonJayamanne requested a review from connor4312 May 21, 2026 05:15
@DonJayamanne DonJayamanne marked this pull request as ready for review May 21, 2026 05:15
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