Skip to content

Filter Copilot sessions by local data#311097

Merged
roblourens merged 1 commit intomainfrom
roblou/filter-copilot-sessions
Apr 17, 2026
Merged

Filter Copilot sessions by local data#311097
roblourens merged 1 commit intomainfrom
roblou/filter-copilot-sessions

Conversation

@roblourens
Copy link
Copy Markdown
Member

This change filters Copilot SDK sessions to only list sessions that already have Agent Host session data. That keeps sessions created by other Copilot CLI agents out of the Agents window without creating per-session databases during listing.

Summary:

  • Gate CopilotAgent.listSessions results on an existing session database via tryOpenDatabase.
  • Defer project resolution and project metadata writes until after the ownership/database-existence gate.
  • Add focused unit coverage with a fake Copilot client and real in-memory SessionDatabase instances.

Validation:

  • Diagnostics clean.
  • CopilotAgent tests passed: 9/9.
  • Hygiene passed on the changed files with only the existing TypeScript-version warning.
  • Council review: no blocking issues found from two reviewers.

(Written by Copilot)

Only list Copilot SDK sessions that already have Agent Host session data, so sessions created by other Copilot CLI agents are filtered out without creating databases during listing.

(Written by Copilot)
Copilot AI review requested due to automatic review settings April 17, 2026 21:05
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

Filters Copilot SDK session listing in the agent host so that only sessions with existing local Agent Host session data (session DB) appear in the Agents window, avoiding side effects (DB creation / project metadata writes) during session enumeration.

Changes:

  • Gate CopilotAgent.listSessions() on an existing session database via ISessionDataService.tryOpenDatabase() (and only then resolve/store project info).
  • Introduce an injectable ICopilotClient surface + factory hook to enable fakes in unit tests.
  • Add focused unit tests using a fake Copilot client and in-memory SessionDatabase instances to verify ownership filtering and metadata reads.
Show a summary per file
File Description
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Adds injectable Copilot client surface and filters session listing to only sessions with existing DB-backed metadata.
src/vs/platform/agentHost/test/node/copilotAgent.test.ts Adds unit coverage validating session filtering by DB existence and metadata read behavior without DB creation.

Copilot's findings

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

Comment thread src/vs/platform/agentHost/node/copilot/copilotAgent.ts
@roblourens roblourens marked this pull request as ready for review April 17, 2026 21:12
@roblourens roblourens enabled auto-merge (squash) April 17, 2026 21:12
@roblourens roblourens merged commit 5711368 into main Apr 17, 2026
30 checks passed
@roblourens roblourens deleted the roblou/filter-copilot-sessions branch April 17, 2026 21:25
@vs-code-engineering vs-code-engineering Bot added this to the 1.117.0 milestone Apr 17, 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.

4 participants