Refactor AgentService instantiation - #331585
Draft
roblourens wants to merge 11 commits into
Draft
Conversation
Create an agent-host application DI scope, construct AgentService through it, and remove child-to-parent service re-exports. Update tests to use the production construction path. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors AgentService construction around a dedicated child DI scope shared by host services and providers.
Changes:
- Adds an agent-host application factory and DI-backed AgentService options.
- Shares scoped services, including
ICopilotApiService, across consumers. - Updates AgentService tests to use the production construction path.
Show a summary per file
| File | Description |
|---|---|
src/vs/platform/agentHost/node/agentHostApplication.ts |
Creates the application DI scope. |
src/vs/platform/agentHost/node/agentService.ts |
Converts AgentService to DI construction. |
src/vs/platform/agentHost/node/agentHostMain.ts |
Uses scoped application services. |
src/vs/platform/agentHost/node/agentHostServerMain.ts |
Applies the scope to standalone hosting. |
src/vs/platform/agentHost/test/node/agentServiceTestUtils.ts |
Adds production-style test construction. |
src/vs/platform/agentHost/test/node/agentService.test.ts |
Migrates AgentService tests. |
src/vs/platform/agentHost/test/node/agentSideEffects.test.ts |
Migrates side-effect tests. |
src/vs/platform/agentHost/test/node/claudeAgent.test.ts |
Migrates Claude provider coverage. |
Review details
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 7/8 changed files
- Comments generated: 0
- Review effort level: Balanced
Update newly added AgentService tests to use the DI-backed test factory. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use explicit bootstrap and application names for service collections and instantiation services. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use one strict DI scope and centralize common base and provider service setup for both Agent Host entry points. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve the single-scope bootstrap while integrating Agent Host debug-log collection. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Expose one runtime factory that owns common file, session, DI, AgentService, diagnostics, and optional provider infrastructure initialization. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Integrate Agent Host proxy configuration ownership and terminal-chat session metadata with the streamlined runtime factory. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Construct and register the AgentService core and collaborator graph outside AgentService, use one guarded initialization step for genuine back-references, and replace the test-only clock injection with virtual timers. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve external AgentService composition while integrating state-file resolution, catalog hardening, durable Agent Merge monitoring, and GitHub MCP support. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve external AgentService composition while integrating cold-start state-file resolution and session artifact tooling. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove optional provider-infrastructure setup, make BYOK policy explicit, and defer Claude SDK environment mutation until first use. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
AgentServicethrough dependency injection in one strict Agent Host service scopecreateAgentHostRuntimecomposition function that always builds the same complete shared service graphagentServiceComposition.ts;AgentServicehas no service collection, instantiation service,services.set,createInstance, or service-class constructionAgentServicerunWithFakedTimersValidation
npm run typecheck-clientnpm run core-cinpm run valid-layers-check426 Upgrade Required(Written by Copilot)