chat: fix cloud session titles in editor window #343331

Merged
roblourens opened 3:21pm on October 21, 2026 wanted to merge 207 Δ into microsoft/vscode main from
roblou/agents/fix-editor-window-title-issue

Pull Request Overview

  • Opened on October 21, 2026
  • Status Merged
  • Commit count 3 with first commit October 21, 2026

Total Delta

207 Total Diff Delta

Open Days

Open 9 weekdays

Test Delta

292 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
0.0 days Authoring 2 commits before pull request opened for review
 
0.0 days Awaiting first review
 
0.1 days Revising work with 1 commit in response to 2 reviews that left 4 comments
 
9.0 days Merge to deploy (still awaiting deployment)

Total time for pull request 0.1 business days from first commit authored to merge
Still awaiting deployment

Author avatar

chat: fix cloud session titles in editor window

Cloud sessions can retain a default-chat title such as main after the host updates the session title. The editor window preferred that chat title, hiding the correct session title.

Use the session title consistently for cloud session list rows, live conversations, and recorded history, matching the Agents window. Route default-session renames to the session channel. Keep independent local default-chat titles and peer-chat titles unchanged.

How to test


  1. Create a Cloud session from the editor window and complete a turn.

  2. Confirm the session list, chat header, and editor tab use the session title rather than the default chat's branch-name title.

  3. Open the same session in the Agents window and confirm the title agrees.

  4. Rename the session from the editor and confirm both windows update.

Exercised this flow against a real cloud session with the fixed Code OSS build on macOS. The host's default chat stayed titled main, while both windows displayed the session title. A manual rename updated both windows and persisted on reconnect.

Two limits observed during live testing: the host retained the initial prompt label rather than generating a short title, and cold discovery after reload briefly shows the older task name until opening the session reconnects to the host. This PR fixes the default-chat/session-title selection mismatch, not task-name synchronization.

(Written by Copilot)

Comments Threads Pending Resolution

ljharb reviewed on October 21, 2026
ljharb left a comment

> [!WARNING]
> Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a `copilot-code-review.yml` file specifying one with the `runs-on` attribute. See the [docs](https://gh.io/AA11tgch) for more details.

## Copilot review overview

1 open issue

- Medium severity [The new `_useSessionTitleForDefaultChat` constructor parameter is required, which forces a large…](https://github.com/microsoft/vscode/pull/343331#discussion_r4341718775) · New

What changed in this PR

Fixes cloud session title selection so the editor window consistently shows the authoritative **session title** (instead of an independent/stale default-chat title like a branch name), aligning behavior with the Agents window and ensuring renames route to the correct channel.

**Changes:**
- Introduces `useSessionTitleForDefaultChat` customization/config flag and wires it through remote-agent-host and cloud sandbox contributions.
- Updates title derivation + rename dispatching so the default chat can use the session title and session channel when configured.
- Expands/adjusts tests to cover stale default-chat titles, notification ordering, and rename routing.

| File | Description |
| ---- | ----------- |
| src/​vs/​workbench/​contrib/​chat/​test/​browser/​remoteAgentHost/​editorCloudSandboxContribution.test.ts | Extends discovery tests to assert the new flag and to model a stale default-chat title in host session state. |
| src/​vs/​workbench/​contrib/​chat/​test/​browser/​remoteAgentHost/​cloudSandboxSessionHandler.test.ts | Updates recorded-history fixtures and expectations to prefer recorded session title over default-chat title. |
| src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostChatContribution.test.ts | Adds coverage for title notifications, independent editor titles without customization, and rename routing with customization enabled. |
| src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​remoteAgentHostConnectionCustomization.ts | Adds customization surface `useSessionTitleForDefaultChat`. |
| src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​remoteAgentHostChatContribution.ts | Forwards the new customization flag into the session handler config. |
| src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​cloudSandboxSessionListController.ts | Enables session-title-for-default-chat behavior for cloud sandbox session list controller. |
| src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​cloudSandboxSessionContribution.ts | Sets cloud sandbox customization to use session title for default chat. |
| src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​cloudSandboxReadOnlySessionHandler.ts | Adjusts read-only title selection to always use session title for default chat. |
| src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionListController.ts | Adds constructor flag and updates list-item title derivation for default chat. |
| src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionListContribution.ts | Updates controller instantiation to pass the new flag (defaulting to `false`). |
| src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionHandler.ts | Routes default-chat renames via session channel when configur...

Resolved Comment Threads

ljharb reviewed on October 21, 2026
ljharb left a comment

> [!WARNING]
> Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a `copilot-code-review.yml` file specifying one with the `runs-on` attribute. See the [docs](https://gh.io/AA11tgch) for more details.

## Copilot review overview

1 open issue

- Medium severity [The new `_useSessionTitleForDefaultChat` constructor parameter is required, which forces a large…](https://github.com/microsoft/vscode/pull/343331#discussion_r4341718775) · New

What changed in this PR

Fixes cloud session title selection so the editor window consistently shows the authoritative **session title** (instead of an independent/stale default-chat title like a branch name), aligning behavior with the Agents window and ensuring renames route to the correct channel.

**Changes:**
- Introduces `useSessionTitleForDefaultChat` customization/config flag and wires it through remote-agent-host and cloud sandbox contributions.
- Updates title derivation + rename dispatching so the default chat can use the session title and session channel when configured.
- Expands/adjusts tests to cover stale default-chat titles, notification ordering, and rename routing.

| File | Description |
| ---- | ----------- |
| src/​vs/​workbench/​contrib/​chat/​test/​browser/​remoteAgentHost/​editorCloudSandboxContribution.test.ts | Extends discovery tests to assert the new flag and to model a stale default-chat title in host session state. |
| src/​vs/​workbench/​contrib/​chat/​test/​browser/​remoteAgentHost/​cloudSandboxSessionHandler.test.ts | Updates recorded-history fixtures and expectations to prefer recorded session title over default-chat title. |
| src/​vs/​workbench/​contrib/​chat/​test/​browser/​agentSessions/​agentHostChatContribution.test.ts | Adds coverage for title notifications, independent editor titles without customization, and rename routing with customization enabled. |
| src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​remoteAgentHostConnectionCustomization.ts | Adds customization surface `useSessionTitleForDefaultChat`. |
| src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​remoteAgentHostChatContribution.ts | Forwards the new customization flag into the session handler config. |
| src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​cloudSandboxSessionListController.ts | Enables session-title-for-default-chat behavior for cloud sandbox session list controller. |
| src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​cloudSandboxSessionContribution.ts | Sets cloud sandbox customization to use session title for default chat. |
| src/​vs/​workbench/​contrib/​chat/​browser/​remoteAgentHost/​cloudSandboxReadOnlySessionHandler.ts | Adjusts read-only title selection to always use session title for default chat. |
| src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionListController.ts | Adds constructor flag and updates list-item title derivation for default chat. |
| src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionListContribution.ts | Updates controller instantiation to pass the new flag (defaulting to `false`). |
| src/​vs/​workbench/​contrib/​chat/​browser/​agentSessions/​agentHost/​agentHostSessionHandler.ts | Routes default-chat renames via session channel when configur...

src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionListController.ts
Outdated
57
		private readonly _sessionListStore: AgentHostSessionListStore,
58
		private readonly _description: string | undefined,
59
		private readonly _connectionAuthority: string,
60
		private readonly _useSessionTitleForDefaultChat: boolean,