Skip to content

Migrate chat implementation to use URIs instead of string ids to track sessions #274403

@mjbvz

Description

@mjbvz

Tracks migrating our chat implementation to use uris instead of string ids to identify chat sessions internally. Uris are preferred as they can correctly support contributed providers

This is a pretty major change so it will broken up into smaller steps. I've done but lot of work trying to get the basics setup but now need help finishing up in individual areas

  • @mjbvz Add initial support for session uris: fb6055c

  • @mjbvz Update IChatService to use uris: db5ee1e

  • @mjbvz Lots of plumbing through of session uris: eef25fc 3bb2ff6 a1f7be3 d9d1b03

  • @joshspicer Convert the clearChatEditor function. We definitely should not be using the forChatSessionTypeAndId call I added but I'm not really sure what we should be doing instead

    Blocks removing forChatSessionTypeAndId and LocalChatSessionUri.parse

  • @osortega Convert the hybrid session stuff in getHybridSessionsForProvider

  • @osortega Remove the use of fake IChatSessionItem entries with id: "show-history" and id: "workbench.panel.chat.view.copilot"

    Blocks removing IChatSessionItem.id

  • @roblourens IChatAgentRequest.sessionId

  • @connor4312 Convert IChatEditingSession.chatSessionId

  • @justschen Convert IChatChangesSummary.sessionId

  • @aeschli Adopt in code mapper. Specifically for ICodeMapperRequest.chatSessionId

  • @Tyriar Adopt for the terminal tool (IChatTerminalToolInvocationData.sessionId plus ChatTerminalToolProgressPart and RunInTerminalTool)

  • @bhavyaus Adopt for ManageTodoListTool

  • @connor4312 ChatResponseResource

Migration

In most cases, the fix is to use the uri associated with the session instead of the id. This is usually pretty straightforward, although it sometimes requires plumbing the sessionResource through a number of functions

A few gotchas/tips:

  • Do not construct or parse the session uris yourself

  • Make sure to use isEqual to compare the uris. Don't use ===

  • If the session id was being used as a key in a map, you'll likely want to switch to use a ResourceMap

  • Use LocalChatSessionUri.forSession to create a URI if you only have a string id. Keep in mind this only works properly for local sessions, so we generally want to move away from this and just pass the uris around directly

  • Use chatSessionResourceToId to go from a uri to an old session id string. This should only be used when you need to preserve the old sessionId for telemetry or persistent storage

Metadata

Metadata

Labels

debtCode quality issues

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions