Skip to content

sessions: decouple sessions layer from agent sessions dependencies#306132

Merged
sandy081 merged 16 commits intomainfrom
copilot/experienced-pigeon
Mar 29, 2026
Merged

sessions: decouple sessions layer from agent sessions dependencies#306132
sandy081 merged 16 commits intomainfrom
copilot/experienced-pigeon

Conversation

@sandy081
Copy link
Copy Markdown
Member

Summary

Systematically removes direct dependencies on the workbench agent sessions layer (src/vs/workbench/contrib/chat/browser/agentSessions/) from the sessions management layer (src/vs/sessions/). After this change, only the adapter files (copilotChatSessionsProvider.ts, copilotChatSessionsActions.ts, remoteAgentHost.contribution.ts) import from agent sessions — everything else uses the sessions layer's own abstractions.

What Changed

Data Model Enrichment

  • IGitHubInfo — new interface on ISession replacing both ISessionPullRequest and IGitHubSessionContext, with owner, repo, and optional pullRequest sub-object (number, uri, icon)
  • Renamed pullRequestgitHubInfo across ISessionData, IChat, ISession
  • The CopilotChatSessionsProvider adapter now populates gitHubInfo with full owner/repo/PR data extracted from agent session metadata

API Removals from ISessionsManagementService

  • getGitHubContext / getGitHubContextForSession — consumers now read session.gitHubInfo directly
  • resolveSessionFileUri — inlined at the single consumer (codeReviewService.ts) using session.workspace
  • getSessionRepositoryUri / getRepositoryFromMetadata — removed (no longer needed)

Dependency Cleanup

  • IAgentSessionsService removed from sessionsManagementService.ts constructor entirely
  • AgentSessionProviders enum replaced with string literal constants (COPILOT_CLI_SESSION_TYPE, COPILOT_CLOUD_SESSION_TYPE) in sessionTypes.ts
  • isAgentSession() type guard replaced with status checks (session.status.get() !== SessionStatus.Untitled)
  • Removed AgentSessionProviders usage from chat.contribution.ts, codeReview.contributions.ts, sessionsList.ts, sessionsTerminalContribution.ts, workspaceFolderManagement.ts, modePicker.ts, changesTitleBarWidget.ts, changesView.ts

Other

  • Deleted fileTreeView.ts (no longer needed)
  • AgentSessionApprovalModel kept as a reusable utility

sandy081 and others added 14 commits March 29, 2026 13:28
…lity to private in SessionsManagementService
…e unused method from SessionsManagementService
…cross sessions layer

Replace direct imports of AgentSessionProviders enum from the workbench
agent sessions layer with CopilotCLISessionType/CopilotCloudSessionType
constants from the sessions layer's own sessionTypes module.

Simplify workspaceFolderManagement to use session workspace data instead
of provider-specific branching. Remove fileTreeView component.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…cker

- changesTitleBarWidget: use ISessionsManagementService instead of
  IAgentSessionsService for session lookup and change events
- changesView: use sessionManagementService.onDidChangeSessions signal
- modePicker: replace AgentSessionProviders with CopilotCLISessionType

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 29, 2026 17:43
@vs-code-engineering vs-code-engineering bot added this to the Backlog milestone Mar 29, 2026
@sandy081 sandy081 self-assigned this Mar 29, 2026
@sandy081 sandy081 enabled auto-merge (squash) March 29, 2026 17:45
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

Decouples the vs/sessions layer from the workbench “agent sessions” implementation by moving session-enrichment responsibilities into the adapter/provider layer and having sessions-window features consume ISession data directly (not via agent-sessions services).

Changes:

  • Replaced pullRequest with richer gitHubInfo (owner, repo, optional pullRequest) across the sessions data model and updated consumers.
  • Removed several GitHub/repository helper APIs from ISessionsManagementService, inlining remaining logic at the single call site.
  • Replaced AgentSessionProviders usage in vs/sessions with sessions-layer session type constants/objects and removed the fileTreeView UI (keeping only the GitHub FS provider registration).

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/vs/sessions/contrib/workspace/browser/workspaceFolderManagement.ts Removes agent-sessions-specific branching and uses session.workspace label when adding the session folder.
src/vs/sessions/contrib/terminal/test/browser/sessionsTerminalContribution.test.ts Updates tests for pullRequestgitHubInfo.
src/vs/sessions/contrib/terminal/browser/sessionsTerminalContribution.ts Uses sessions-layer session type (CopilotCLISessionType.id) instead of AgentSessionProviders.
src/vs/sessions/contrib/sessions/test/browser/sessionsList.test.ts Updates test session shape for gitHubInfo.
src/vs/sessions/contrib/sessions/common/sessionData.ts Introduces IGitHubInfo and renames pullRequest to gitHubInfo across session/chat interfaces.
src/vs/sessions/contrib/sessions/browser/views/sessionsList.ts Updates rendering logic to use gitHubInfo.pullRequest.icon and sessions-layer session type IDs.
src/vs/sessions/contrib/sessions/browser/sessionsManagementService.ts Removes agent-sessions service dependencies and deletes GitHub/repo helper APIs in favor of direct session data consumption.
src/vs/sessions/contrib/sessions/browser/sessionTypes.ts Replaces AgentSessionProviders enum dependency with sessions-layer string constants and ISessionType objects.
src/vs/sessions/contrib/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts Updates session adapters to expose gitHubInfo instead of pullRequest.
src/vs/sessions/contrib/github/browser/github.contribution.ts Switches GitHub refresh logic to read session.gitHubInfo directly.
src/vs/sessions/contrib/fileTreeView/browser/media/fileTreeView.css Removes unused CSS for deleted view.
src/vs/sessions/contrib/fileTreeView/browser/fileTreeView.ts Deletes the file tree view implementation.
src/vs/sessions/contrib/copilotChatSessions/browser/modePicker.ts Uses sessions-layer session type ID for resolving custom agent targets.
src/vs/sessions/contrib/copilotChatSessions/browser/copilotChatSessionsProvider.ts Adapter now populates gitHubInfo (owner/repo/PR data) from agent session metadata.
src/vs/sessions/contrib/codeReview/test/browser/codeReviewService.test.ts Removes stubs for deleted ISessionsManagementService APIs.
src/vs/sessions/contrib/codeReview/browser/codeReviewService.ts Reads PR context from session.gitHubInfo and inlines file URI resolution from session.workspace.
src/vs/sessions/contrib/codeReview/browser/codeReview.contributions.ts Updates session-type gating to use sessions-layer cloud session type ID.
src/vs/sessions/contrib/chat/test/browser/sessionsConfigurationService.test.ts Updates tests for pullRequestgitHubInfo.
src/vs/sessions/contrib/chat/browser/chat.contribution.ts Uses sessions-layer session type IDs for worktree-opening behavior.
src/vs/sessions/contrib/changes/browser/fixCIChecksAction.ts Uses gitHubInfo for PR/CI lookup and request routing.
src/vs/sessions/contrib/changes/browser/changesView.ts Stops listening directly to agent sessions model events and uses sessions management events; PR context now read from gitHubInfo.
src/vs/sessions/contrib/changes/browser/changesTitleBarWidget.ts Re-renders on sessions-management events and reads changes from ISession.

Comment thread src/vs/sessions/contrib/codeReview/browser/codeReviewService.ts Outdated
Comment thread src/vs/sessions/contrib/changes/browser/changesTitleBarWidget.ts
Comment thread src/vs/sessions/contrib/changes/browser/changesView.ts
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bpasero
bpasero previously approved these changes Mar 29, 2026
@sandy081 sandy081 merged commit fcecb74 into main Mar 29, 2026
18 checks passed
@sandy081 sandy081 deleted the copilot/experienced-pigeon branch March 29, 2026 18:43
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