Skip to content

Adopt copilot/sdk session-title APIs and sync title across session list, editor, CLI #312038

Merged
anthonykim1 merged 10 commits intomainfrom
anthonykim1/updateCLIsessionTitle
Apr 23, 2026
Merged

Adopt copilot/sdk session-title APIs and sync title across session list, editor, CLI #312038
anthonykim1 merged 10 commits intomainfrom
anthonykim1/updateCLIsessionTitle

Conversation

@anthonykim1
Copy link
Copy Markdown
Contributor

@anthonykim1 anthonykim1 commented Apr 22, 2026

Resolves: #311535

  • Renaming a Copilot CLI session title from VS Code now sticks everywhere it
    should — sessions list, chat editor tab/header, and copilot --resume in
    the terminal.

  • Adopts the copilot/sdk session-title APIs so the SDK is the source of truth
    instead of a local label cache.

Side fix after some surprise 😮:

Noticed the chat panel/header was not syncing on rename even when
the sessions list was. The two surfaces share no state:

  • Sessions list is driven by ChatSessionItem.label from the contributed
    item provider.
  • Chat editor tab / panel header is driven by the open chat model's title,
    which only updates when something fires setCustomTitle on the model.

This PR would bridge the gap there as well. -> In mainThreadChatSessions so a label change on a
live session propagates into the chat model.

AFTER PR:
Screenshot 2026-04-22 at 5 00 56 PM

How titles flow:

  • Manual rename in VS Code writes to the SDK's name field.
  • AI-generated titles (from the chat title provider) write to the SDK's summary field.
  • copilot --resume renames write to name too, and VS Code picks them up the next time it reads metadata.
  • The sidebar and the chat editor header now go through the same resolver, so they always show the same thing.

How a title is picked, in order:

  1. An explicit title if there is one (live session title, SDK name, or legacy custom title).
  2. A derived label we cached on a previous pass.
  3. The pending prompt, for sessions that just started.
  4. A clean summary from metadata (skipped if it looks truncated — ends with ... or contains <).
  5. The first user message from session history (cached if we find one).
  6. The raw summary as a last resort, just for display — not cached.

A couple of things worth calling out:

  • Both renameSession and updateSessionSummary clear the cached derived label, so a brand-new title is never hidden behind an old cached one.
  • Before this PR, the sidebar and the editor had slightly different orders of precedence and only the sidebar used the cache, so they could disagree. They share one path now.

/cc @DonJayamanne

anthonykim1 and others added 2 commits April 22, 2026 16:05
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@anthonykim1 anthonykim1 added this to the 1.118.0 milestone Apr 22, 2026
@anthonykim1 anthonykim1 self-assigned this Apr 22, 2026
Copilot AI review requested due to automatic review settings April 22, 2026 23:32
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 22, 2026

Screenshot Changes

Base: 01ae82da Current: d81e2476

Changed (24)

agentSessionsViewer/CompletedRead/Dark
Before After
before after
agentSessionsViewer/CompletedRead/Light
Before After
before after
agentSessionsViewer/CompletedUnread/Dark
Before After
before after
agentSessionsViewer/CompletedUnread/Light
Before After
before after
agentSessionsViewer/FailedWithDuration/Dark
Before After
before after
agentSessionsViewer/FailedWithDuration/Light
Before After
before after
agentSessionsViewer/FailedWithoutDuration/Dark
Before After
before after
agentSessionsViewer/FailedWithoutDuration/Light
Before After
before after
agentSessionsViewer/WithDiffChanges/Dark
Before After
before after
agentSessionsViewer/WithDiffChanges/Light
Before After
before after
agentSessionsViewer/WithFileChangesList/Dark
Before After
before after
agentSessionsViewer/WithFileChangesList/Light
Before After
before after
agentSessionsViewer/WithBadge/Dark
Before After
before after
agentSessionsViewer/WithBadge/Light
Before After
before after
agentSessionsViewer/WithMarkdownBadge/Dark
Before After
before after
agentSessionsViewer/WithMarkdownBadge/Light
Before After
before after
agentSessionsViewer/WithBadgeAndDiff/Dark
Before After
before after
agentSessionsViewer/WithBadgeAndDiff/Light
Before After
before after
agentSessionsViewer/CloudProvider/Dark
Before After
before after
agentSessionsViewer/CloudProvider/Light
Before After
before after
agentSessionsViewer/BackgroundProvider/Dark
Before After
before after
agentSessionsViewer/BackgroundProvider/Light
Before After
before after
agentSessionsViewer/ClaudeProvider/Dark
Before After
before after
agentSessionsViewer/ClaudeProvider/Light
Before After
before after

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

This PR adopts the @github/copilot/sdk session title APIs as the source of truth for Copilot CLI session titles, and ensures title changes propagate across the VS Code sessions list, the chat editor tab/header, and terminal resume flows.

Changes:

  • Propagate session-item label changes to the active chat model so editor/header titles stay in sync.
  • Switch Copilot CLI session title retrieval/updates to SDK-backed metadata (name/summary) and add SDK summary update support.
  • Update Copilot CLI session service logic, mocks, and tests to validate rename/summary/title synchronization.
Show a summary per file
File Description
src/vs/workbench/api/browser/mainThreadChatSessions.ts Syncs contributed session item label changes into the live chat model title.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts After generating a title, updates the SDK session summary so CLI/VS Code surfaces stay consistent.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessions.ts Stages generated titles for brand-new sessions and uses SDK getSessionTitle when building list items.
extensions/copilot/src/extension/chatSessions/copilotcli/vscode-node/customSessionTitleServiceImpl.ts Makes title generation return a value without persisting it, leaving persistence to callers.
extensions/copilot/src/extension/chatSessions/copilotcli/node/test/testHelpers.ts Extends SDK session mocks with name and title update methods + metadata support.
extensions/copilot/src/extension/chatSessions/copilotcli/node/test/copilotCliSessionService.spec.ts Adds tests for rename/summary updates and staged-title sync into the SDK.
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts Implements SDK-backed title querying + writable-session operations for rename/summary updates and staged-title syncing on session creation.

Copilot's findings

  • Files reviewed: 7/7 changed files
  • Comments generated: 3

Comment thread src/vs/workbench/api/browser/mainThreadChatSessions.ts
anthonykim1 and others added 4 commits April 22, 2026 16:43
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
@anthonykim1 anthonykim1 marked this pull request as ready for review April 23, 2026 01:00
roblourens
roblourens previously approved these changes Apr 23, 2026
@anthonykim1 anthonykim1 marked this pull request as draft April 23, 2026 03:30
@anthonykim1 anthonykim1 marked this pull request as ready for review April 23, 2026 03:33
rebornix
rebornix previously approved these changes Apr 23, 2026
@anthonykim1 anthonykim1 enabled auto-merge (squash) April 23, 2026 03:39
@anthonykim1 anthonykim1 disabled auto-merge April 23, 2026 03:45
@anthonykim1 anthonykim1 marked this pull request as draft April 23, 2026 03:45
Co-authored-by: Copilot <copilot@github.com>
@anthonykim1 anthonykim1 reopened this Apr 23, 2026
@anthonykim1 anthonykim1 marked this pull request as ready for review April 23, 2026 04:55
@anthonykim1 anthonykim1 merged commit 4fb20b8 into main Apr 23, 2026
31 of 49 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/updateCLIsessionTitle branch April 23, 2026 05:34
return existing;
}

// Propagate a renamed item label to the open chat model so the chat editor tab
Copy link
Copy Markdown
Contributor Author

@anthonykim1 anthonykim1 Apr 27, 2026

Choose a reason for hiding this comment

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

agentsPending.mov

Maybe what's causing the temporary title change? @roblourens @DonJayamanne

This is meant to ensure title is synced across session list, chat editor header though.
Edit: Addressed issue where pending title would flicker in agents app in #312657

Copy link
Copy Markdown
Contributor

@DonJayamanne DonJayamanne Apr 27, 2026

Choose a reason for hiding this comment

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

Thanks @anthonykim1 ,

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.

Adopt Copilot CLI sdk API for custom session titles

6 participants