Skip to content

agentHost: Filter external Copilot sessions - #331187

Merged
Benjamin Christopher Simmonds (benibenj) merged 3 commits into
mainfrom
agents/create-worktree-copilot-session-filter
Aug 17, 2026
Merged

agentHost: Filter external Copilot sessions#331187
Benjamin Christopher Simmonds (benibenj) merged 3 commits into
mainfrom
agents/create-worktree-copilot-session-filter

Conversation

@benibenj

Copy link
Copy Markdown
Contributor

What does this PR do?

Filters Copilot external SDK session discovery so it only imports sessions that:

  • have persisted clientName equal to github/cli or github/autopilot;
  • were modified within the last seven days; and
  • include non-empty persisted repository metadata.

Sessions with unknown or missing client names, stale sessions, and repository-less sessions are excluded. Legacy extension-host adoption remains unchanged. The provider specification documents that clientName identifies the runtime client that created or last resumed a session rather than immutable creator provenance.

Testing

  • npm run typecheck-client
  • npm run eslint -- src\vs\platform\agentHost\node\copilot\copilotAgent.ts src\vs\platform\agentHost\test\node\copilotAgent.test.ts
  • .\scripts\test.bat --run src\vs\platform\agentHost\test\node\copilotAgent.test.ts --grep "external chat discovery" (10 passing)

Only discover standalone Copilot CLI and GitHub Copilot app sessions that have repository metadata and were modified within the last seven days. Preserve legacy extension-host adoption and cover accepted and rejected metadata boundaries.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restricts Copilot external-session discovery to recent, repository-backed sessions from approved clients while preserving legacy adoption behavior.

Changes:

  • Filters by client name, repository metadata, and seven-day age.
  • Uses persisted SDK session data for classification.
  • Adds focused boundary and exclusion tests.
Show a summary per file
File Description
AGENT_HOST_SESSIONS_PROVIDER.md Documents external Copilot session eligibility.
copilotAgent.test.ts Tests client, age, and repository filtering.
copilotAgent.ts Implements external-session filtering and diagnostics.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

Gate the raw session-list RPC used by external discovery so the migration-toggle test no longer waits on the obsolete convenience listSessions seam.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Apply the repository TypeScript formatter to the raw session-list test fixture.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit e0d6297 into main Aug 17, 2026
27 checks passed
@benibenj
Benjamin Christopher Simmonds (benibenj) deleted the agents/create-worktree-copilot-session-filter branch August 17, 2026 13:11
@vs-code-engineering vs-code-engineering Bot added this to the 1.135.0 milestone Aug 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.

3 participants