When in the Agents app, return all sessions#312229
Merged
TylerLeonhardt merged 1 commit intomainfrom Apr 23, 2026
Merged
Conversation
and make sure that git stuff is gated behind workspace trust. Co-authored-by: Copilot <copilot@github.com>
mjbvz
approved these changes
Apr 23, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Copilot’s chat sessions integration to (1) list all Claude sessions when running inside the dedicated Agents app/workspace and (2) gate git-derived session metadata/change detection behind workspace trust, via a workspace-service abstraction.
Changes:
- Add
IWorkspaceService.isResourceTrusted(...)and implement it across VS Code, null, simulation, and mock workspace services. - In Claude sessions UI, only fetch git metadata and workspace changes for trusted working directories; run metadata+changes concurrently when trusted.
- In Agents sessions workspace, list all Claude sessions by calling the SDK without a directory argument; update docs and tests accordingly.
Show a summary per file
| File | Description |
|---|---|
| extensions/copilot/src/platform/workspace/vscode/workspaceServiceImpl.ts | Implements isResourceTrusted via VS Code workspace API. |
| extensions/copilot/src/platform/workspace/common/workspaceService.ts | Adds isResourceTrusted to the workspace service interface/abstractions and null implementation. |
| extensions/copilot/src/platform/test/node/simulationWorkspaceServices.ts | Implements isResourceTrusted for simulation workspace service. |
| extensions/copilot/src/platform/ignore/node/test/mockWorkspaceService.ts | Updates mock workspace service to implement isResourceTrusted. |
| extensions/copilot/src/extension/test/node/notebookPromptRendering.spec.ts | Updates a test workspace stub to implement isResourceTrusted. |
| extensions/copilot/src/extension/chatSessions/vscode-node/sessionOptionGroupBuilder.ts | Uses workspace-service trust check to treat untrusted folders as non-git. |
| extensions/copilot/src/extension/chatSessions/vscode-node/claudeChatSessionContentProvider.ts | Gates Claude session metadata + workspace changes behind resource trust; parallelizes trusted fetches. |
| extensions/copilot/src/extension/chatSessions/claude/node/test/mockClaudeCodeSdkService.ts | Makes listSessions accept an optional directory parameter for Agents mode. |
| extensions/copilot/src/extension/chatSessions/claude/node/sessionParser/test/claudeCodeSessionService.spec.ts | Adds coverage for Agents workspace “list all sessions” behavior; wires new DI dependency. |
| extensions/copilot/src/extension/chatSessions/claude/node/sessionParser/claudeCodeSessionService.ts | Lists all sessions (no dir) when in Agents workspace; adds IAgentSessionsWorkspace dependency. |
| extensions/copilot/src/extension/chatSessions/claude/node/claudeCodeSdkService.ts | Updates SDK wrapper/interface to support listSessions(dir?). |
| extensions/copilot/src/extension/chatSessions/claude/CLAUDE_SESSION_USER_GUIDE.md | Documents trust-gated git metadata/change detection in session list UI. |
| extensions/copilot/src/extension/chatSessions/claude/AGENTS.md | Documents trust gating + concurrency behavior for metadata/changes enrichment. |
Copilot's findings
Comments suppressed due to low confidence (2)
extensions/copilot/src/extension/chatSessions/vscode-node/claudeChatSessionContentProvider.ts:738
IWorkspaceService.isResourceTrustedtakes avscode.Uri, butURI.file(session.cwd)is the internal URI type. This should be converted to avscode.Uribefore callingisResourceTrusted(e.g.,vscode.Uri.file(session.cwd)orvscode.Uri.from(...)) to avoid type errors and ensure the trust check works correctly.
if (session.cwd) {
const isTrusted = await this._workspaceService.isResourceTrusted(URI.file(session.cwd));
if (isTrusted) {
extensions/copilot/src/extension/chatSessions/vscode-node/claudeChatSessionContentProvider.ts:775
cwdUriis an internalURI, butIWorkspaceService.isResourceTrustedis defined to take avscode.Uri. ConvertcwdUrito avscode.Uribefore checking trust (or adjust the workspace service API to accept the internal URI type consistently). This affects call sites that invoke_buildSessionMetadata(cwd)without passingisTrusted.
private async _buildSessionMetadata(cwd: string, isTrusted?: boolean): Promise<SessionMetadata> {
const cwdUri = URI.file(cwd);
if (!(isTrusted ?? await this._workspaceService.isResourceTrusted(cwdUri))) {
return { workingDirectoryPath: cwd };
}
- Files reviewed: 13/13 changed files
- Comments generated: 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
and make sure that git stuff is gated behind workspace trust.
Co-authored-by: Copilot copilot@github.com