Re-implement lazy loading of chat session items without using IAgentSessionsService in the sessions workbench

Open
#320,480 3 comments 0 reactions 1 assignee View on GitHub

@DonJayamanne is already working on this.

Since Jun 8, 2026.

Assessment

This issue has not been assessed yet.

Description

Context

Commit c385fd3ddeb819e2b4d0563b4621990bafdbef6c (PR #312047, "feat(copilot): enable lazy loading for chat session items") introduced calls to IAgentSessionsService.model.observeSession(...) directly inside the sessions workbench (src/vs/sessions):

  • src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts (renderSession)
  • src/vs/sessions/services/sessions/browser/visibleSessions.ts (_getOrCreateVisibleSession, originally added in sessionsManagementService.setActiveSession)

This violates the sessions layer architecture: IAgentSessionsService / the agent sessions model (vs/workbench/contrib/chat/browser/agentSessions/**) must only be consumed by the Copilot chat sessions provider (contrib/providers/copilotChatSessions/browser/copilotChatSessionsProvider.ts), never by shared sessions-workbench code. The sessions layer is provider-agnostic and must not reach into a specific provider's model.

What was done

The cross-layer observeSession triggers and the IAgentSessionsService dependency were reverted from sessionsList.ts and visibleSessions.ts (plus the now-stale test scaffolding). This removes the lazy-loading trigger that those calls provided.

Follow-up needed

Re-implement lazy loading of chat session items (the on-demand observeSession trigger that populates expensive properties such as changes/badges) the right way, without importing IAgentSessionsService into the sessions workbench. Options to consider:

  • Drive the trigger from inside the Copilot provider itself (it already legitimately depends on IAgentSessionsService), e.g. by reacting to a provider-agnostic visibility signal exposed by ISessionsManagementService / ISession.
  • Or expose a provider-agnostic "session became visible/closed" signal on the sessions services that the Copilot provider subscribes to in order to call observeSession on its own sessions.

cc @DonJayamanne (author of PR #312047)

Dominant language
TypeScript
Stars
193k
Forks
42.9k
PR merge metrics
PR metrics pending

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/vscode

All issues in microsoft/vscode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.