Skip to content

chat: add startup telemetry for live chat model counts#307678

Merged
roblourens merged 2 commits intomainfrom
copilot/high-kite
Apr 3, 2026
Merged

chat: add startup telemetry for live chat model counts#307678
roblourens merged 2 commits intomainfrom
copilot/high-kite

Conversation

@roblourens
Copy link
Copy Markdown
Member

After reviving sessions with pending edits at startup, fire a chat.modelsAtStartup telemetry event with:

  • totalModels — total live chat models
  • modelsOpenInWidgets — models currently displayed in a chat widget/editor (via IChatWidgetService.getWidgetBySessionResource)
  • backgroundModels — models alive but not in any widget
  • modelsKeptAliveOnlyForEdits — background models kept alive solely because they have unaccepted edits

Implementation details

  • Exposes whenSessionsRevived promise on IChatService so consumers can await session revival completion
  • Telemetry lives in a browser-layer WorkbenchPhase.AfterRestored contribution, so it runs after widgets have restored and after revival completes
  • Uses IChatWidgetService.getWidgetBySessionResource() to classify models (no hard-coded holder strings)

After reviving sessions with pending edits at startup, log telemetry
with the number of live chat models, how many are open in widgets,
how many are background-only, and how many are kept alive solely
because they have unaccepted edits.

- Expose whenSessionsRevived promise on IChatService
- Add browser-layer contribution that awaits revival + uses
  IChatWidgetService to classify models without hard-coded strings

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 3, 2026 17:26
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 adds a startup telemetry event that reports counts of live chat models after pending-edit sessions are revived, enabling insight into how many models are visible in widgets vs kept alive in the background.

Changes:

  • Exposed IChatService.whenSessionsRevived so callers can await completion of startup revival of sessions with pending edits.
  • Implemented whenSessionsRevived in ChatService (and test mock) and wired it to the existing reviveSessionsWithEdits() startup task.
  • Added an AfterRestored workbench contribution that logs chat.modelsAtStartup telemetry by classifying models using IChatWidgetService.getWidgetBySessionResource(...).

Reviewed changes

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

File Description
src/vs/workbench/contrib/chat/test/common/chatService/mockChatService.ts Updates test mock to implement the new whenSessionsRevived API surface.
src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.ts Stores the session-revival promise on the service so consumers can await it.
src/vs/workbench/contrib/chat/common/chatService/chatService.ts Adds whenSessionsRevived to IChatService.
src/vs/workbench/contrib/chat/browser/chat.contribution.ts Adds and registers an AfterRestored telemetry contribution that logs model-count telemetry at startup.

…check

- Wrap reviveSessionsWithEdits with .catch() to avoid unhandled rejection
- Mark logTelemetry() as void fire-and-forget
- Check referenceCount === 1 for modelsKeptAliveOnlyForEdits

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@roblourens roblourens marked this pull request as ready for review April 3, 2026 18:11
@roblourens roblourens enabled auto-merge (squash) April 3, 2026 18:11
@roblourens roblourens merged commit 66639f8 into main Apr 3, 2026
19 checks passed
@roblourens roblourens deleted the copilot/high-kite branch April 3, 2026 18:24
@vs-code-engineering vs-code-engineering bot added this to the 1.115.0 milestone Apr 3, 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