Agent Host client tool hangs after active client removal; browser click invoked with empty args
@connor4312 is already working on this.
Since Jun 25, 2026.
Assessment
This issue has not been assessed yet.
Description
Summary
A browser clickElement tool call can get stuck in Preparing after the Agent Host removes the active client. The click never reaches Playwright; the workbench invokes the browser tool with {} parameters and crashes during tool preparation.
Observed
In an Agents/Copilot CLI session using built-in browser tools:
openBrowserPagesucceeds.clickElementon the initialStartbutton succeeds.screenshotPagesucceeds.- The next
clickElementon the board'sRunbutton stays stuck atPreparing.
The session event stream ends with:
tool.execution_start clickElement
permission.requested clickElement
# no permission.completed
# no tool.execution_complete
Key log evidence
The model requested valid arguments:
{
"element": "Run button on Research Agent",
"pageId": "<page-id>",
"ref": "e200"
}
But the workbench invoked the underlying browser tool with empty parameters:
[AgentHost] Invoking client tool: clickElement
[LanguageModelToolsService#invokeTool] Invoking tool click_element with parameters {}
[error] Cannot read properties of undefined (reading 'toString')
at createBrowserPageLink(...)
at ClickBrowserTool.prepareToolInvocation(...)
The AHP sequence for the same tool call was:
chat/toolCallStart clickElement
chat/toolCallReady confirmed="not-needed" # no toolInput
chat/toolCallComplete success=false error="Client <client-id> disconnected before completing clickElement"
chat/toolCallReady confirmation UI with real toolInput
About 6 seconds earlier, the same session received:
session/activeClientRemoved clientId=<client-id>
Suspected cause
This looks like an Agent Host/client-tool lifecycle race:
- The active client is removed from session state while the UI/client connection is still participating in the turn.
- A later client-contributed browser tool call is treated as orphaned/disconnected.
- The synthetic
toolCallReadywithouttoolInputis consumed by the workbench client-tool handler. - The handler falls back to
{}and invokesclick_elementbefore the latertoolCallReadycontaining the realtoolInputarrives. ClickBrowserTool.prepareToolInvocationassumespageIdis present, callscreateBrowserPageLink(undefined), throws, and the original Copilot tool execution remains stuck waiting for completion/permission state.
Relevant code paths:
src/vs/platform/agentHost/node/protocolServerHandler.ts- disconnected client tool call handling emits synthetic ready/complete events
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.ts- missing
toolInputfalls back to{}once status is notStreaming
- missing
src/vs/workbench/contrib/browserView/electron-browser/tools/clickBrowserTool.tsprepareToolInvocationassumespageIdis defined
Expected
A disconnected/orphaned client-tool call should fail cleanly and unblock the model/UI, or be retried with a replacement active client. It should not invoke the local browser tool with {} parameters or leave the tool call stuck in Preparing.
Possible fixes
- Do not invoke client tools from
toolCallReadyevents that lacktoolInputwhen the tool has required arguments or_meta.toolArgumentsexists. - Ensure disconnected-client synthetic
toolCallReady/toolCallCompleteordering cannot race with later confirmation UI events for the same tool call. - Harden browser tool
prepareToolInvocationagainst missingpageIdso malformed protocol state becomes a clean tool error. - Investigate why
session/activeClientRemovedfired while the client was still successfully confirming/completing tool calls in the same session.
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.9k
- PR merge metrics
- PR metrics pending
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/vscode
-
testplan-item
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
new release
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
testplan-item
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
testplan-item
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
All issues in microsoft/vscode
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·