Skip to content

Fix agent host agents in vscode#312628

Merged
roblourens merged 2 commits intomainfrom
roblou/agents/vs-code-copilot-cli-agent-issue
Apr 26, 2026
Merged

Fix agent host agents in vscode#312628
roblourens merged 2 commits intomainfrom
roblou/agents/vs-code-copilot-cli-agent-issue

Conversation

@roblourens
Copy link
Copy Markdown
Member

Fixes the "command 'workbench.action.chat.openNewChatSessionInPlace.agent-host-copilotcli' not found" error that fires when switching to the local Copilot CLI agent host from the session-type picker in VS Code.

What

  • In ChatSessionsService.registerChatSessionContribution, also populate _contributionDisposables so programmatic contributions participate in the autorun that registers openNewChatSessionInPlace.<type> actions.
  • In AgentHostContribution._registerAgent, suffix the agent's displayName with " - Agent Host" when running in VS Code, to disambiguate from the extension-host Copilot CLI harness which uses the same label. The Agents window keeps the original displayName.

Why

The autorun in chatSessions.contribution.ts iterates _contributions filtered by _contributionDisposables.has(...) to register the per-type "New {0} Session" action. Only extension-contributed providers were being added to that map (via _evaluateAvailability); programmatic registrations (used by both local and remote agent hosts) only populated _contributions, so the autorun filtered them out and no command was registered.

This affected both local agent host (agent-host-copilotcli) and remote agent host (remote-*) types.

Notes for reviewers

  • The label disambiguation only applies in VS Code (!_isSessionsWindow). The Agents window already shows only agent-host sessions, so no suffix is needed.
  • No new tests; the fix is a one-line wiring change in a path exercised at runtime by AgentHostContribution.

(Written by Copilot)

…tions

The autorun that registers `openNewChatSessionInPlace.<type>` actions
filters `_contributions` by `_contributionDisposables.has(...)`. Only
extension-contributed providers were getting added to that map (via
`_evaluateAvailability`), so programmatically-registered contributions
(local + remote agent hosts) had no in-place action and the session-type
picker in VS Code threw "command not found" when switching to the local
Copilot CLI agent host.

Mark programmatic registrations as active in
`registerChatSessionContribution` so they participate in the autorun.

Also disambiguate the agent-host displayName in VS Code by suffixing
"- Agent Host", since the extension-host Copilot CLI harness uses the
same "Copilot CLI" label. The Agents window keeps the original
displayName.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 26, 2026 20:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes missing openNewChatSessionInPlace.<type> command registration for programmatic chat session contributions (notably local/remote agent-host providers), and disambiguates agent-host session labels in VS Code’s session-type picker.

Changes:

  • Mark programmatic chat session contributions as “available” so the constructor autorun registers per-type in-place “New {0} Session” actions/commands.
  • Ensure programmatic contributions clean up their availability/disposable entry on unregister.
  • Suffix agent-host displayName with “ - Agent Host” in VS Code (but not in the Agents window) to avoid label collisions.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts Treat programmatic contributions as available for in-place action/command registration; dispose availability state on unregister.
src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostChatContribution.ts Disambiguate agent-host provider display names in VS Code’s picker via a localized suffix.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 1

…ister/unregister

Programmatic chat session contributions bypass _evaluateAvailability,
which was the only path that called _updateHasCanDelegateProvidersContextKey.
Update the context key directly in registerChatSessionContribution and its
dispose so UI gated on ChatContextKeys.hasCanDelegateProviders stays in sync.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roblourens roblourens changed the title chat: register in-place action for programmatic chat session contributions Fix agent host agents in vscode Apr 26, 2026
@roblourens roblourens enabled auto-merge (squash) April 26, 2026 20:35
@roblourens roblourens merged commit 15d2d8c into main Apr 26, 2026
39 of 41 checks passed
@roblourens roblourens deleted the roblou/agents/vs-code-copilot-cli-agent-issue branch April 26, 2026 21:54
@vs-code-engineering vs-code-engineering Bot added this to the 1.118.0 milestone Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants