Add chat model reference inspection#306596
Merged
roblourens merged 7 commits intomainfrom Mar 31, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds new developer-facing diagnostics to inspect live chat model references and track who created/retains each model, to help debug leaks and “pending disposal” cases across chat/session acquisition paths.
Changes:
- Introduces reference-owner + creation-owner tracking in
ChatModelStoreand exposes a debug snapshot API. - Threads a
debugOwnerlabel throughIChatServicesession acquisition/loading APIs and key call sites. - Adds a new developer command to render a Markdown inspection report for live chat model references, plus focused tests for the new tracking/keep-alive behavior.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/model/chatModelStore.ts | Tracks reference holders/creation owner and exposes a debug snapshot of live models/references. |
| src/vs/workbench/contrib/chat/common/chatService/chatService.ts | Extends IChatService API with debug-owner threading and a new debug snapshot accessor. |
| src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts | Implements debug-owner plumbing and surfaces model reference debug snapshot from the model store. |
| src/vs/workbench/contrib/chat/common/model/chatModel.ts | Adds debug-owner labels for self-reference keep-alive holders. |
| src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.ts | Adds “Inspect Chat Model References” developer command outputting a Markdown report. |
| src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.ts | Passes debug-owner labels through session load/restore paths. |
| src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditorInput.ts | Passes debug-owner labels when resolving/loading/creating sessions. |
| src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.ts | Passes debug-owner label when creating quick chat sessions. |
| src/vs/workbench/contrib/chat/browser/chatSessions/chatSessions.contribution.ts | Passes debug-owner label when sending prompts via sessions contribution. |
| src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionHoverWidget.ts | Passes debug-owner label when loading model for hover UI. |
| src/vs/workbench/contrib/chat/browser/actions/chatImportExport.ts | Passes debug-owner label for “import session” path. |
| src/vs/workbench/contrib/chat/browser/actions/chatForkActions.ts | Passes debug-owner label for fork-from-data paths. |
| src/vs/workbench/contrib/chat/test/common/model/chatModelStore.test.ts | Adds tests validating holder/creator tracking + pending-disposal-without-holders reporting. |
| src/vs/workbench/contrib/chat/test/common/chatService/chatService.test.ts | Adds test asserting modified-edits keep-alive holder attribution. |
| src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts | Updates mock to satisfy new IChatService API surface. |
Yoyokrazy
approved these changes
Mar 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Validation
npm run compile-check-ts-nativechatModelStore.test.tsand the new modified-edits keep-alive assertion inchatService.test.tschatService.test.tsfile also hit an existing unrelated failure inretrieveSession(0 !== 2), so the focused validation was used insteadnode --experimental-strip-types build/hygiene.ts ...on the changed files(Written by Copilot)