agents: add "Debug Local Agent Host Process In Dev Tools" command#312246
Merged
roblourens merged 4 commits intomainfrom Apr 23, 2026
Merged
agents: add "Debug Local Agent Host Process In Dev Tools" command#312246roblourens merged 4 commits intomainfrom
roblourens merged 4 commits intomainfrom
Conversation
Adds a Developer command, available in both VS Code and the Agents app, that opens a Chrome DevTools window attached to the local agent host utility analogous to the existing 'Debug Extension Host Inprocess Dev Tools' command. The agent host process enables its inspector live via node:inspector on demand, so no restart is required. The renderer reaches the inspector URL through the existing agent-host IPC channel. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new developer command to attach Chrome DevTools to the local agent host utility process by enabling (or reusing) a Node.js inspector listener and opening the corresponding devtools:// URL. This is registered both in VS Code’s chat developer actions and in the standalone Agents app.
Changes:
- Introduces
getInspectInfo(tryEnable)onIConnectionTrackerServiceand surfaces it viaIAgentHostService. - Implements inspector enablement and DevTools URL creation in the agent host utility process using the Node
inspectormodule. - Adds a new
Action2(Developer: Debug Local Agent Host Process In Dev Tools) and registers it in both VS Code and the Agents app.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/electron-browser/actions/debugAgentHostAction.ts | New Action2 that requests inspect info and opens a DevTools child window. |
| src/vs/workbench/contrib/chat/electron-browser/actions/chatDeveloperActions.ts | Registers the new debug action in VS Code. |
| src/vs/sessions/sessions.desktop.main.ts | Wires the Agents app contribution module. |
| src/vs/sessions/contrib/chat/electron-browser/debugAgentHost.contribution.ts | Registers the new debug action in the Agents app. |
| src/vs/platform/agentHost/node/agentHostMain.ts | Implements getInspectInfo using inspector.url()/inspector.open() and builds the DevTools URL. |
| src/vs/platform/agentHost/electron-browser/agentHostService.ts | Forwards getInspectInfo from renderer to the IPC connection tracker. |
| src/vs/platform/agentHost/common/agentService.ts | Adds IAgentHostInspectInfo + new getInspectInfo API on service/IPC interfaces. |
| src/vs/platform/agentHost/browser/nullAgentHostService.ts | Adds a null/browser implementation returning undefined for inspect info. |
| eslint.config.js | Allows importing the Node inspector builtin. |
Copilot's findings
- Files reviewed: 9/9 changed files
- Comments generated: 1
Move the registerAction2(DebugAgentHostInDevToolsAction) call into the existing openInVSCode.contribution.ts, which is already imported from sessions.desktop.main.ts. Drops the standalone debugAgentHost.contribution.ts. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
zhichli
previously approved these changes
Apr 23, 2026
Use URL parser instead of a regex so IPv6 hosts (ws://[::1]:PORT/...) are accepted and wildcard hosts (0.0.0.0, ::) are normalized to loopback. Addresses code review on PR #312246. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
connor4312
previously approved these changes
Apr 23, 2026
Hides the command from the command palette when AI features are disabled, fixing the 'can disable AI features' smoke test. (Written by Copilot) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
bryanchen-d
approved these changes
Apr 23, 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.
Adds a
Developer: Debug Local Agent Host Process In Dev Toolscommand — analogous to the existingDeveloper: Debug Extension Host In Dev Tools— that opens a Chrome DevTools window attached to the local agent host utility process. Registered for both VS Code and the Agents app.How it works
getInspectInfo(tryEnable)onIConnectionTrackerService(and surfaced throughIAgentHostService).node:inspectormodule:inspector.url()to read the current listener, orinspector.open(0, '127.0.0.1', false)to enable on a random local port if it's not already on.getInspectInfo(true)and thenINativeHostService.openDevToolsWindow(devtoolsUrl). On failure to enable, it shows a notification.Differences from the extension-host equivalent
node:inspectordirectly rather than Electron'sUtilityProcess.enableInspectPort()+ stderr scraping, so no main-process plumbing.inspector.openenables the inspector live, so unlike the extension-host action there's nothing to restart.Files
platform/agentHost/common/agentService.ts—IAgentHostInspectInfo+getInspectInfoon the IPC and service interfaces.platform/agentHost/node/agentHostMain.ts— implementation usingnode:inspector.platform/agentHost/electron-browser/agentHostService.ts— renderer-side forwarder.platform/agentHost/browser/nullAgentHostService.ts— null impl returnsundefined.workbench/contrib/chat/electron-browser/actions/debugAgentHostAction.ts— theAction2(extracted so the Agents app can register it without pulling in the full chatDeveloperActions module).workbench/contrib/chat/electron-browser/actions/chatDeveloperActions.ts— registers it in VS Code.sessions/contrib/chat/electron-browser/debugAgentHost.contribution.ts(+sessions.desktop.main.ts) — registers it in the Agents app.eslint.config.js— allows importinginspector(Node built-in) under the same allow-list asos,crypto, etc.(Written by Copilot)