microsoft / microsoft/vscode

Chat Editor: custom agent resets to Agent on first send

Open
#335,176 0 comments 0 reactions 1 assignee Claimed by @pwang347 View on GitHub
agent-host chat-customizations
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

## Type: Bug

Regular VS Code Chat Editor using the Copilot Agent Host harness.

Discussion and screenshots: https://vscodeteam.slack.com/archives/C0AJZ5319PZ/p1788381749454329

## Reproduction

1. Open the VS Code repository in an Insiders editor window.
2. Open a fresh Chat Editor using the **Copilot** harness.
3. Select the real **Data** custom agent.
4. Send `hi`.

This reproduces again for every fresh session. After the first turn has completed, selecting Data again sticks for subsequent turns.

## Actual

The first request runs, but the newly established Chat Editor resets its mode picker from `Data` to default `Agent`.

## Expected

The real session created by the first send keeps the mode selected in the untitled Chat Editor, so `Data` remains selected while the request runs and after it completes.

## Root cause

`ChatService._materializeUntitledSession` creates and loads the real contributed-session model before sending the first request. It carries the untitled model's intended language model, but not the submitted chat mode. The request itself receives the correct custom `modeInfo`, while the real model bound into the widget still has its default `Agent` input mode.

The submitted mode must be transferred to the real model by whichever first send wins pending-request arbitration, including concurrent and late sends still addressed to the untitled URI.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.