Remove dead requestHandler from AgentHostChatSession#309932
Merged
roblourens merged 2 commits intomainfrom Apr 14, 2026
Merged
Conversation
Remove the unused `requestHandler` property and `_sendRequest` constructor parameter from `AgentHostChatSession`. The real code path uses registered agent `invoke()` → `_invokeAgent()` → `_handleTurn()`, making `requestHandler` dead code (confirmed by an existing todo@connor4312 comment). Update tests to invoke turns through the registered agent's `invoke()` method instead of calling `requestHandler` directly. (Written by Copilot)
Contributor
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes dead code from the Agent Host chat session implementation by deleting the unused requestHandler property and related _sendRequest constructor plumbing, and updates the associated tests to drive turns through the registered agent invoke() path (which matches the real production flow).
Changes:
- Remove
AgentHostChatSession.requestHandlerand the unused_sendRequestconstructor parameter/call site. - Update agent host session contribution tests to start turns via the registered agent’s
impl.invoke()instead ofsession.requestHandler. - Extend test request helpers to allow overriding
agentIdand align sessionResource scheme with the chosen agent.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts | Removes dead requestHandler and _sendRequest plumbing from AgentHostChatSession and its instantiation. |
| src/vs/workbench/contrib/chat/test/browser/agentSessions/agentHostChatContribution.test.ts | Refactors tests/helpers to invoke turns through the registered agent implementation instead of requestHandler. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 2
…s in tests Add observeTools mock and fix getValue to return an array for chat.agentHost.clientTools, preventing the observeTools TypeError that was causing 71 test failures in CI.
Yoyokrazy
approved these changes
Apr 14, 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.
Remove the unused
requestHandlerproperty and_sendRequestconstructor parameter fromAgentHostChatSession. The real code path uses registered agentinvoke()→_invokeAgent()→_handleTurn(), makingrequestHandlerdead code (confirmed by an existingtodo@connor4312comment).Changes
requestHandlerproperty,_sendRequestconstructor parameter, and the dead_sendRequestcallback at thecreateInstancecall sitestartTurn/startDynamicAgentTurnhelpers and all call sites to invoke turns through the registered agent'sinvoke()method instead of callingrequestHandlerdirectly(Written by Copilot)