Skip to content

Conversation

@osortega
Copy link
Contributor

Related to: #268219

This adds a new command to support creating new chats with metadata

Copilot AI review requested due to automatic review settings September 24, 2025 20:57
@osortega osortega self-assigned this Sep 24, 2025
Copy link
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 adds support for creating new chat sessions with metadata by introducing a new command and updating the chat session infrastructure to handle metadata throughout the chat lifecycle.

  • Adds a new action OpenNewChatSessionEditorWithMetadata to create chat editors with custom metadata
  • Updates chat session types and interfaces to properly type metadata as Record<string, any>
  • Enhances the chat session service to extract and pass metadata from existing editors when resolving sessions

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/vs/workbench/contrib/chat/browser/actions/chatSessionActions.ts Adds new OpenNewChatSessionEditorWithMetadata action class
src/vs/workbench/contrib/chat/browser/chat.contribution.ts Registers the new metadata action and updates imports
src/vs/workbench/contrib/chat/browser/chatEditor.ts Extends IChatEditorOptions interface to include optional metadata field
src/vs/workbench/contrib/chat/browser/chatSessions.contribution.ts Updates metadata type definition and adds metadata extraction logic

for (const editor of group.editors) {
if (editor instanceof ChatEditorInput) {
try {
if (editor.sessionId === request.sessionId) {
Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

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

The metadata assignment should be placed after the null check for editor.options. If editor.options is undefined, accessing editor.options.metadata will throw a runtime error.

Suggested change
if (editor.sessionId === request.sessionId) {
if (editor.sessionId === request.sessionId && editor.options) {

Copilot uses AI. Check for mistakes.
});
}

async run(accessor: ServicesAccessor, chatSessionType: string, metadata: Record<string, any>) {
Copy link

Copilot AI Sep 24, 2025

Choose a reason for hiding this comment

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

The chatSessionType and metadata parameters lack input validation. Consider adding validation to ensure chatSessionType is not empty and metadata is a valid object to prevent runtime errors.

Copilot uses AI. Check for mistakes.
@vs-code-engineering vs-code-engineering bot added this to the September 2025 milestone Sep 24, 2025
request,
prompt: request.message,
history,
metadata
Copy link
Member

Choose a reason for hiding this comment

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

I am deleting this dynamic agent with #268089

@osortega osortega marked this pull request as draft September 24, 2025 21:08
@rebornix rebornix modified the milestones: September 2025, October 2025 Oct 3, 2025
@mjbvz mjbvz modified the milestones: October 2025, November 2025 Nov 12, 2025
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.

5 participants