Unify agentHost server-side dispatch: remove IProtocolSideEffectHandler#306158
Merged
roblourens merged 3 commits intomainfrom Mar 30, 2026
Merged
Unify agentHost server-side dispatch: remove IProtocolSideEffectHandler#306158roblourens merged 3 commits intomainfrom
roblourens merged 3 commits intomainfrom
Conversation
Eliminate the IProtocolSideEffectHandler interface and make ProtocolServerHandler talk to IAgentService directly. This removes the duplicate adapter layer between the WebSocket protocol server and the real service implementation. Changes: - ProtocolServerHandler now takes IAgentService + SessionStateManager + IProtocolServerConfig instead of IProtocolSideEffectHandler - Deleted ~40-line inline adapter in agentHostMain.ts - agentHostServerMain.ts now uses AgentService instead of manually wiring SessionStateManager + AgentSideEffects - Removed implements IProtocolSideEffectHandler from AgentSideEffects - Removed dead methods from AgentSideEffects that were only needed by the deleted interface (handleCreateSession, handleDisposeSession, handleListSessions, handleGetResourceMetadata, handleAuthenticate, getDefaultDirectory) - Type conversions (URI<->string, IAgentSessionMetadata<->ISessionSummary) now happen at the protocol boundary in ProtocolServerHandler - Fixed dispatchAction double-dispatch: WS path previously dispatched to stateManager AND called handleAction (which dispatched again) - Extension methods (getResourceMetadata, authenticate, etc.) now call IAgentService directly instead of untyped fallbacks (Written by Copilot)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the extra server-side adapter layer (IProtocolSideEffectHandler) and routes WebSocket JSON-RPC requests directly to IAgentService, aligning the WebSocket and IPC dispatch paths and simplifying the standalone agent host server wiring.
Changes:
- Refactors
ProtocolServerHandlerto depend onIAgentService(plus config) and removesIProtocolSideEffectHandler. - Updates the standalone server (
agentHostServerMain.ts) to construct and useAgentServicedirectly. - Updates unit tests and protocol documentation to reflect the new dispatch boundary and protocol validation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/vs/platform/agentHost/test/node/protocolServerHandler.test.ts | Reworks mocks/tests to target IAgentService instead of the removed side-effect handler interface. |
| src/vs/platform/agentHost/test/node/agentSideEffects.test.ts | Removes tests for side-effect handler methods that were deleted along with IProtocolSideEffectHandler. |
| src/vs/platform/agentHost/protocol.md | Updates contributor checklist to reflect the new handler/service boundary. |
| src/vs/platform/agentHost/node/protocolServerHandler.ts | Main refactor: dispatches protocol operations to IAgentService, adds config, removes IProtocolSideEffectHandler, fixes double-dispatch. |
| src/vs/platform/agentHost/node/agentSideEffects.ts | Drops implements IProtocolSideEffectHandler and deletes side-effect methods that were only needed for that interface. |
| src/vs/platform/agentHost/node/agentHostServerMain.ts | Simplifies standalone server wiring to create AgentService and pass it to ProtocolServerHandler. |
| src/vs/platform/agentHost/node/agentHostMain.ts | Removes the inline adapter and wires ProtocolServerHandler directly to AgentService. |
Co-authored-by: Copilot <copilot@github.com>
connor4312
approved these changes
Mar 30, 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.
Eliminate the
IProtocolSideEffectHandlerinterface and makeProtocolServerHandlertalk toIAgentServicedirectly. This removes the duplicate adapter layer between the WebSocket protocol server and the real service implementation.Problem
There were two different server-side dispatch layers for the same operations, both ending up at
AgentService:ProxyChannelauto-serializesIAgentServicemethod callsProtocolServerHandler→IProtocolSideEffectHandler→ manual adapter →AgentServiceThe
IProtocolSideEffectHandlerinterface duplicatedIAgentServicewith different method signatures, required a ~40-line inline adapter inagentHostMain.ts, and the standalone server (agentHostServerMain.ts) manually wiredSessionStateManager+AgentSideEffectsinstead of usingAgentService.Changes
ProtocolServerHandlernow takesIAgentService+SessionStateManager+IProtocolServerConfiginstead ofIProtocolSideEffectHandlerIProtocolSideEffectHandlerinterface entirelyagentHostMain.tsagentHostServerMain.tsnow createsAgentServiceinstead of manually wiringSessionStateManager+AgentSideEffectsimplements IProtocolSideEffectHandlerfromAgentSideEffectsAgentSideEffectsthat were only needed by the deleted interface (handleCreateSession,handleDisposeSession,handleListSessions,handleGetResourceMetadata,handleAuthenticate,getDefaultDirectory)URI↔string,IAgentSessionMetadata↔ISessionSummary) now happen at the protocol boundary inProtocolServerHandlerdispatchActiondouble-dispatch: WS path previously dispatched tostateManagerAND calledhandleAction(which dispatched to stateManager again)getResourceMetadata,authenticate, etc.) now callIAgentServicedirectly instead of untyped fallbacksauthenticateparams are now validated with proper JSON-RPC error code (-32602)(Written by Copilot)