Skip to content

Display last used model info for Copilot CLI on chat panel #311769

Merged
anthonykim1 merged 8 commits intomainfrom
anthonykim1/cliShouldShowModel
Apr 22, 2026
Merged

Display last used model info for Copilot CLI on chat panel #311769
anthonykim1 merged 8 commits intomainfrom
anthonykim1/cliShouldShowModel

Conversation

@anthonykim1
Copy link
Copy Markdown
Contributor

@anthonykim1 anthonykim1 commented Apr 21, 2026

Resolves: #303960

microsoft/vscode-copilot-chat#4605 didn't quite work for me — it returns ChatResult.details from the request handler, which is fine for local chat, but Copilot CLI goes through the chat session provider api, and on the first request the untitled session gets swapped out for a real one.

That swap makes VS Code throw away the in-memory chat model and rebuild history from scratch by replaying sdk events 🧐 — and the replay path was dropping result.details on the floor, so the model badge never made it back onto the first response.

After this PR you would see:

Screenshot 2026-04-21 at 1 38 06 PM

anthonykim1 and others added 2 commits April 21, 2026 11:40
Copilot AI review requested due to automatic review settings April 21, 2026 20:08
@anthonykim1 anthonykim1 self-assigned this Apr 21, 2026
@anthonykim1 anthonykim1 added this to the 1.118.0 milestone Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 21, 2026

Screenshot Changes

Base: 498c4699 Current: 52ad0c7e

Changed (2)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
agentSessionsViewer/NeedsInput/Dark
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 ensures Copilot CLI sessions can display the “last used model” footer/badge reliably by preserving ChatResult.details through the contributed-session “untitled → real session” swap and subsequent history replay/rebuild paths.

Changes:

  • Extend chat session history (and DTO/protocol plumbing) to carry optional details on response turns.
  • Restore details onto the response model when VS Code rebuilds a contributed session from history.
  • Teach Copilot CLI session reconstruction to attach model details to the final rebuilt response, and add/adjust tests.
Show a summary per file
File Description
src/vs/workbench/contrib/chat/common/chatSessionsService.ts Adds details?: string to response history items.
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts Applies replayed details onto the last request’s response result during session load.
src/vs/workbench/api/common/extHostChatSessions.ts Serializes response-turn result.details into the session history DTO.
src/vs/workbench/api/common/extHost.protocol.ts Extends IChatSessionHistoryItemDto (response) with details?: string.
src/vs/workbench/api/browser/mainThreadChatSessions.ts Revives details from DTO into IChatSessionHistoryItem responses.
extensions/copilot/src/extension/chatSessions/vscode-node/copilotCLIChatSessionsContribution.ts Returns a ChatResult.details string based on the selected CLI model (pre-swap).
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotcliSessionService.ts Computes model details during history rebuild and passes it into event→turn conversion.
extensions/copilot/src/extension/chatSessions/copilotcli/node/copilotCli.ts Introduces formatModelDetails() helper.
extensions/copilot/src/extension/chatSessions/vscode-node/test/copilotCLIChatSessionParticipant.spec.ts Asserts handleRequest returns details for rendering as footer detail.
extensions/copilot/src/extension/chatSessions/copilotcli/common/copilotCLITools.ts Allows injecting lastResponseDetails and applies it to the final rebuilt response turn.
extensions/copilot/src/extension/chatSessions/copilotcli/common/test/copilotCLITools.spec.ts Adds coverage that rebuilt history preserves result.details.
extensions/copilot/src/extension/chatSessions/copilotcli/node/test/copilotCliSessionService.spec.ts Updates constructor call sites for the new ICopilotCLIModels dependency.

Copilot's findings

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

anthonykim1 and others added 3 commits April 21, 2026 13:16
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
parts: turn.parts.map((part: IChatProgressDto) => revive(part) as IChatProgress),
participant: turn.participant
participant: turn.participant,
details: turn.details,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Could pass in result as in:

	export interface ChatResult {
		nextQuestion?: {
			prompt: string;
			participant?: string;
			command?: string;
		};
		/**
		 * An optional detail string that will be rendered at the end of the response in certain UI contexts.
		 */
		details?: string;
	}

but that seems like a waste since I doubt everything there would be something we would use in the future?

@anthonykim1 anthonykim1 merged commit b41c998 into main Apr 22, 2026
26 checks passed
@anthonykim1 anthonykim1 deleted the anthonykim1/cliShouldShowModel branch April 22, 2026 04:49
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.

Copilot CLI: Display last used model info

3 participants