Adopt a sealed Agent Host service graph - #332036
Merged
Merged
Conversation
Narrow internal service dependencies, move runtime collaborators out of AgentService, and replace two-phase initialization with a constructor-complete composition. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Give the complete Agent Host service graph one disposable runtime owner and document workbench-style placement rules for bootstrap instances, shared orchestration services, and runtime activation. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve the AgentService import conflict and update the Agent Host architecture guide for composition-owned services. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Base automatically changed from
roblou/agents/agent-service-bootstrap-improvements
to
main
August 21, 2026 22:14
…o roblou/agents/agent-host-service-model
Add the target service-placement model and a tested sealable process-local service collection without enabling the seal in production yet. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build callback, state, configuration, authentication, endpoint, proxy, and request foundations before telemetry and share the synchronous path with AgentService tests. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Migrate bootstrap-owned core and host services to local descriptors, eagerly resolve them under strict DI, and preserve typed test overrides. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Migrate composition-owned and Copilot-dependent services atomically to local descriptors, resolve the complete graph eagerly, and reject late registrations. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make network diagnostics and edit attribution immutable AgentService dependencies and order test-graph teardown after composition-owned listeners. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move changeset and completion registrations into an order-preserving post-graph activation phase with explicit disposable ownership. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve runtime services through DI, reduce the runtime facade, harden proxy and disposal invariants, and mark the service construction guide current. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve the sealed service graph while incorporating the latest Agent Host client-connection changes from main. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Centralizes Agent Host service construction, dependency injection, activation, and disposal under one runtime owner.
Changes:
- Splits service creation into foundation, descriptor, composition, and contribution phases.
- Replaces
AgentServiceservice getters with direct dependency injection. - Adds service-graph tests and ownership documentation.
Show a summary per file
| File | Description |
|---|---|
.github/instructions/agentHostTesting.instructions.md |
Links service-construction guidance. |
src/vs/platform/agentHost/AGENTS.md |
Updates architecture documentation. |
src/vs/platform/agentHost/common/agentService.ts |
Narrows the service interface. |
src/vs/platform/agentHost/node/AGENTS.md |
Documents construction and ownership rules. |
src/vs/platform/agentHost/node/agentHostBootstrap.ts |
Builds and owns the runtime graph. |
src/vs/platform/agentHost/node/agentHostCommitOperationHandler.ts |
Injects authentication directly. |
src/vs/platform/agentHost/node/agentHostContributions.ts |
Centralizes contribution activation. |
src/vs/platform/agentHost/node/agentHostCustomizationEnablementService.ts |
Updates ownership documentation. |
src/vs/platform/agentHost/node/agentHostGitStateService.ts |
Injects authentication directly. |
src/vs/platform/agentHost/node/agentHostMain.ts |
Resolves runtime services through DI. |
src/vs/platform/agentHost/node/agentHostProxyResolver.ts |
Constructor-injects configuration. |
src/vs/platform/agentHost/node/agentHostPullRequestOperationHandler.ts |
Injects authentication directly. |
src/vs/platform/agentHost/node/agentHostServerMain.ts |
Adopts runtime ownership and DI. |
src/vs/platform/agentHost/node/agentHostServices.ts |
Defines local service descriptors. |
src/vs/platform/agentHost/node/agentService.ts |
Accepts explicit collaborators and dependencies. |
src/vs/platform/agentHost/node/agentServiceComposition.ts |
Composes orchestration services. |
src/vs/platform/agentHost/node/agentServiceFoundation.ts |
Creates pre-DI foundation services. |
src/vs/platform/agentHost/test/node/agentHostBootstrap.test.ts |
Tests bootstrap and proxy initialization. |
src/vs/platform/agentHost/test/node/agentHostCommitOperationHandler.test.ts |
Updates authentication test fixtures. |
src/vs/platform/agentHost/test/node/agentHostGitStateService.test.ts |
Updates authentication test fixtures. |
src/vs/platform/agentHost/test/node/agentHostPullRequestOperationHandler.test.ts |
Updates authentication test fixtures. |
src/vs/platform/agentHost/test/node/agentHostRequestService.test.ts |
Tests constructor-bound proxy configuration. |
src/vs/platform/agentHost/test/node/agentHostServices.test.ts |
Tests registration, sealing, and disposal. |
src/vs/platform/agentHost/test/node/agentService.test.ts |
Uses composition-level test seams. |
src/vs/platform/agentHost/test/node/agentServiceTestUtils.ts |
Builds the production-like test graph. |
src/vs/platform/agentHost/test/node/copilotAgent.test.ts |
Removes obsolete proxy binding. |
src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts |
Removes obsolete token method. |
Review details
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Suppressed comments (1)
src/vs/platform/agentHost/AGENTS.md:708
- This ownership statement is outdated: these services are now registered as descriptors in
registerAgentHostCoreServices, andInstantiationServiceconstructs them. Since this is the architecture guide, naming composition as their constructor gives future service moves the wrong ownership model.
Both `IAgentHostPromptCache` and `IAgentHostSessionTitleSignal` are constructed
and registered by `createAgentServiceComposition`. Consumers resolve their
service identifiers through constructor injection; `AgentService` neither owns
nor exposes them.
- Files reviewed: 19/19 changed files
- Comments generated: 2
- Review effort level: Balanced
Define one primary runtime graph while allowing explicitly owned child instantiation services and scoped service collections when isolation requires them. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Separate stable service-graph contracts from accepted callback, worktree, foundation, concrete-type, and test-seam warts with explicit exit conditions. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rename the service guide, add maintenance rules, explain eager resolution as migration-risk control, and distinguish one primary graph from valid scoped child graphs. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Expose worktree binding as a narrow customization-enablement capability and remove the composition root's concrete implementation assertion. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Route tests through the composition-owned state manager and fix bootstrap cleanup ordering found during review. Clarify descriptor rules for trailing defaulted parameters. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Review details
Suppressed comments (1)
src/vs/platform/agentHost/node/agentHostContributions.ts:25
- If a later contribution/provider activation throws, this local store is never returned or disposed. The runtime catch disposes the service graph, but it does not own the
createInstancecontributions orworkspaceFiles; previously registered contributions can therefore survive partial activation and leak their registrations. Make activation transactional by disposingstorebefore rethrowing.
export function activateAgentHostContributions(accessor: ServicesAccessor, instantiationService: IInstantiationService): DisposableStore {
const store = new DisposableStore();
const changesetOperationService = accessor.get(IAgentHostChangesetOperationService);
- Files reviewed: 20/21 changed files
- Comments generated: 1
- Review effort level: Balanced
Ensure activation failures clean up registrations created earlier in the contribution phase and cover the failure path with a focused test. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Allow a sealed descriptor to be replaced only by an instance of its registered constructor, and reject unrelated implementations before descriptor resolution. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
roblourens
marked this pull request as ready for review
August 22, 2026 02:05
roblourens
marked this pull request as draft
August 22, 2026 02:06
roblourens
marked this pull request as ready for review
August 22, 2026 02:07
roblourens
enabled auto-merge (squash)
August 22, 2026 02:08
Vijay Upadya (vijayupadya)
approved these changes
Aug 22, 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.
Refactor the Agent Host node runtime to use one strict, sealed process-local service graph modeled after the VS Code shared process.
SyncDescriptors.node/AGENTS.mdwith service placement, descriptor, ownership, testing, and extension rules.Validation: client typecheck and 639 targeted Agent Host tests pass. (Written by Copilot)