Skip to content

agentHost: extract Copilot session launcher#320203

Merged
roblourens merged 1 commit into
mainfrom
agents/improve-codebase-architecture-focus-on-the-copil-51b4d749
Jun 6, 2026
Merged

agentHost: extract Copilot session launcher#320203
roblourens merged 1 commit into
mainfrom
agents/improve-codebase-architecture-focus-on-the-copil-51b4d749

Conversation

@roblourens
Copy link
Copy Markdown
Member

Summary

  • move Copilot SDK create/resume configuration into CopilotSessionLauncher
  • keep CopilotAgentSession runtime callbacks behind a private adapter instead of public session methods
  • update Copilot agent/session tests to exercise the launcher/runtime seam

Validation

  • npm run compile-check-ts-native
  • env -u ELECTRON_RUN_AS_NODE ./scripts/test.sh src/vs/platform/agentHost/test/node/copilotAgent.test.ts src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts
  • npm run valid-layers-check
  • node --experimental-strip-types build/hygiene.ts src/vs/platform/agentHost/node/copilot/copilotAgent.ts src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts src/vs/platform/agentHost/node/copilot/copilotSessionLauncher.ts src/vs/platform/agentHost/test/node/copilotAgent.test.ts src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts

(Written by Copilot)

Move Copilot SDK session creation and resume configuration into a focused launcher so CopilotAgent owns lifecycle concerns and CopilotAgentSession owns runtime behavior through a private adapter. (Written by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 6, 2026 02:29
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

This PR refactors the Copilot agent-host session startup path by extracting SDK create/resume configuration into a dedicated CopilotSessionLauncher, and by narrowing CopilotAgentSession’s public surface so the Copilot SDK runtime callbacks are routed through a private runtime adapter seam. The accompanying tests are updated to validate behavior across this new launcher/runtime boundary.

Changes:

  • Introduces CopilotSessionLauncher to centralize Copilot SDK session configuration and create/resume (including resume fallback) behavior.
  • Updates CopilotAgentSession to use a private ICopilotSessionRuntime adapter instead of exposing SDK callback handlers as public session methods.
  • Adjusts agent/session unit tests to exercise the new launcher/runtime seam and validate callback wiring (e.g., permission flow).
Show a summary per file
File Description
src/vs/platform/agentHost/node/copilot/copilotSessionLauncher.ts New launcher encapsulating SDK config + create/resume logic and wiring runtime callbacks/tools.
src/vs/platform/agentHost/node/copilot/copilotAgentSession.ts Switches from wrapper-factory to launcher + private runtime adapter; narrows callback entrypoints.
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Uses CopilotSessionLauncher and constructs CopilotSessionLaunchPlan for create/resume paths.
src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts Updates tests to call runtime adapter callbacks and validates the new seam.
src/vs/platform/agentHost/test/node/copilotAgent.test.ts Updates agent tests to capture SDK create options via launch plan and validate permission handler wiring.

Copilot's findings

  • Files reviewed: 5/5 changed files
  • Comments generated: 0

@roblourens roblourens marked this pull request as ready for review June 6, 2026 16:14
@roblourens roblourens enabled auto-merge (squash) June 6, 2026 16:14
@roblourens roblourens merged commit 9146ae1 into main Jun 6, 2026
26 checks passed
@roblourens roblourens deleted the agents/improve-codebase-architecture-focus-on-the-copil-51b4d749 branch June 6, 2026 17:02
@vs-code-engineering vs-code-engineering Bot added this to the 1.124.0 milestone Jun 6, 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