Skip to content

agentHost: keep draft agents in client space - #345314

Merged
Connor Peet (connor4312) merged 2 commits into
mainfrom
connor4312/341862-draft-agents
Oct 31, 2026
Merged

Connor Peet (connor4312) merged 2 commits into
mainfrom
connor4312/341862-draft-agents

Conversation

@connor4312

Copy link
Copy Markdown
Member

Follow-up to #345306 for #341862. This addresses the two Copilot review comments on that PR. It merged before the fix was pushed.

Fixes two review findings in the draft agent flow for same-host and remote connections.

  • Converts the reconciled draft agent to the client-space URI that the picker and chat modes use. Before, the selection used the host URI, so the picker could show the default agent.
  • Compares the plugin container in client space before the loading wait and the load-error check. Before, a same-host plugin used a vscode-agent-host-file URI, so a first message did not wait for the plugin and did not report a load failure.
  • Decodes a vscode-agent-host-file source URI before draft agents are matched to published agents.

How to test

  1. In a Remote-SSH window, add a plugin on the remote host that contributes a custom agent with chat.pluginLocations.
  2. Start a new Copilot CLI session, choose the plugin's agent in the picker before the plugin finishes loading, and send a message.
  3. Confirm that the picker keeps the custom agent and that the first turn waits for the plugin and runs with that agent.

Validation

  • npm run eslint -- <3 changed files>: passed
  • npm run typecheck-client: passed
  • ./scripts/test.sh --reporter dot --run src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts --run src/vs/sessions/contrib/providers/agentHost/test/browser/agentHostAgentPicker.test.ts: passed (643 passing, 11 pending). The new editor-remote cases fail without the fix.

Fixes two review findings in the draft agent flow for same-host and remote connections.

- Converts the reconciled draft agent to the client-space URI that the picker and chat modes
  use. Before, the selection used the host URI, so the picker could show the default agent.
- Compares the plugin container in client space before the loading wait and the load-error
  check. Before, a same-host plugin used a vscode-agent-host-file URI, so a first message did
  not wait for the plugin and did not report a load failure.
- Decodes a vscode-agent-host-file source URI before draft agents are matched to published
  agents.

(Commit message generated by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 31, 2026 00:28
@connor4312
Connor Peet (connor4312) enabled auto-merge (squash) October 31, 2026 00:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The Dev Container handoff can lose copied-plugin source identity under non-identity URI mapping, causing reloads to bypass loading/error guards and preventing reconciliation to a new materialized agent URI.

1 open issue
What changed in this PR

This follow-up to #345306 corrects draft-agent URI handling across local and remote Agent Host connections, addressing selection and plugin-loading problems related to #341862.

Changes:

  • Keeps reconciled draft-agent selections in client URI space.
  • Normalizes plugin and source URIs for matching, loading waits, and load-error checks.
  • Adds regression tests for successful and failed same-host plugin loading on local and editor-remote connections.
File Description
src/​vs/​workbench/​contrib/​chat/​common/​agentHostSessionCustomizations.ts Extracts a helper to decode same-host plugin URIs into client space.
src/​vs/​sessions/​contrib/​providers/​agentHost/​test/​browser/​localAgentHostSessionsProvider.test.ts Tests loading waits, error handling, and preserved agent identity.
src/​vs/​sessions/​contrib/​providers/​agentHost/​browser/​baseAgentHostSessionsProvider.ts Updates draft-agent reconciliation and plugin containment checks to use client-space URIs.

Review effort: Balanced

setAgent now also matches the published host-space agent URI that getCustomAgents()
returns, as the Dev Container handoff passes. Before, only the client-space URI matched,
so a remote connection lost the agent's client source, a plugin reload skipped the
loading and error checks, and the draft agent was not reconciled.

(Commit message generated by Copilot)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@connor4312
Connor Peet (connor4312) merged commit 8f75e5e into main Oct 31, 2026
55 checks passed
@connor4312
Connor Peet (connor4312) deleted the connor4312/341862-draft-agents branch October 31, 2026 00:50
@vs-code-engineering vs-code-engineering Bot added this to the 1.145.0 milestone Oct 31, 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