Skip to content

Add chat model reference inspection#306596

Merged
roblourens merged 7 commits intomainfrom
roblou/chat-model-reference-inspection
Mar 31, 2026
Merged

Add chat model reference inspection#306596
roblourens merged 7 commits intomainfrom
roblou/chat-model-reference-inspection

Conversation

@roblourens
Copy link
Copy Markdown
Member

@roblourens roblourens commented Mar 31, 2026

Summary

  • add a developer command to inspect live chat model references, holders, and pending-disposal state
  • thread debug owner labels through chat session acquisition paths so the inspection output shows who created or is retaining each model
  • attribute startup-revived pending-edit sessions and modified-edit self-retention so stale edit-backed models are easier to diagnose

Validation

  • VS Code build watch stayed clean for the touched files
  • npm run compile-check-ts-native
  • focused tests passed for chatModelStore.test.ts and the new modified-edits keep-alive assertion in chatService.test.ts
  • running the compiled chatService.test.ts file also hit an existing unrelated failure in retrieveSession (0 !== 2), so the focused validation was used instead
  • node --experimental-strip-types build/hygiene.ts ... on the changed files

(Written by Copilot)

Copilot AI review requested due to automatic review settings March 31, 2026 05:20
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

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 ChatModelStore and exposes a debug snapshot API.
  • Threads a debugOwner label through IChatService session 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.

Comment thread src/vs/workbench/contrib/chat/common/chatService/chatService.ts
@roblourens roblourens marked this pull request as ready for review March 31, 2026 16:27
@roblourens roblourens enabled auto-merge (squash) March 31, 2026 16:27
@roblourens roblourens merged commit 3bc9423 into main Mar 31, 2026
18 checks passed
@roblourens roblourens deleted the roblou/chat-model-reference-inspection branch March 31, 2026 18:41
@vs-code-engineering vs-code-engineering bot added this to the 1.115.0 milestone Mar 31, 2026
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.

3 participants