agentHost: extract Copilot session launcher#320203
Merged
roblourens merged 1 commit intoJun 6, 2026
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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
CopilotSessionLauncherto centralize Copilot SDK session configuration and create/resume (including resume fallback) behavior. - Updates
CopilotAgentSessionto use a privateICopilotSessionRuntimeadapter 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
lszomoru
approved these changes
Jun 6, 2026
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.
Summary
CopilotSessionLauncherCopilotAgentSessionruntime callbacks behind a private adapter instead of public session methodsValidation
npm run compile-check-ts-nativeenv -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.tsnpm run valid-layers-checknode --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)