Skip to content

Add automode.routerModelSelection telemetry with actualModel#310238

Open
aashna wants to merge 1 commit intomainfrom
aashnagarg/actual-model-telemetry
Open

Add automode.routerModelSelection telemetry with actualModel#310238
aashna wants to merge 1 commit intomainfrom
aashnagarg/actual-model-telemetry

Conversation

@aashna
Copy link
Copy Markdown
Contributor

@aashna aashna commented Apr 15, 2026

Emits a new telemetry event after all client-side model overrides (same-provider, vision fallback, default selection) are applied.

Properties:

  • candidateModel: the router's top pick (candidate_models[0])
  • actualModel: the model actually used after all overrides
  • overrideReason: none, defaultFallback, or clientOverride
  • conversationId: for correlation

This enables accurate switch attribution without fragile cross-event joins. The existing automode.routerDecision event captures the router's recommendation, but doesn't know what model was ultimately selected because vision fallback and default selection happen afterward.

Analysts can now query automode.routerModelSelection directly:
| where candidateModel != actualModel
| summarize count() by candidateModel, actualModel

@aashna aashna requested review from Copilot and lramos15 and removed request for Copilot April 15, 2026 21:39
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 15, 2026

Screenshot Changes

Base: 7133939e Current: 53777b8a

Changed (1)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after

blocks-ci screenshots changed

Replace the contents of test/componentFixtures/blocks-ci-screenshots.md with:

Updated blocks-ci-screenshots.md
<!-- auto-generated by CI — do not edit manually -->

#### editor/codeEditor/CodeEditor/Dark
![screenshot](https://hediet-screenshots.azurewebsites.net/images/cb32a3e854b5734fe5aaca2318f2e0a42ee821b05ea97883ea42c5ba95edb3c3)

#### editor/codeEditor/CodeEditor/Light
![screenshot](https://hediet-screenshots.azurewebsites.net/images/42624fbba5e0db7f32c224b5eb9c5dd3b08245697ae2e7d2a88be0d7c287129b)

@aashna aashna force-pushed the aashnagarg/actual-model-telemetry branch from f829091 to c72380d Compare April 15, 2026 23:10
Copilot AI review requested due to automatic review settings April 15, 2026 23:10
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 a new telemetry event to capture the router’s recommended model vs the final model actually used in Auto Mode, after client-side selection adjustments.

Changes:

  • Emits automode.routerModelSelection telemetry after model selection is finalized.
  • Extends _tryRouterSelection to return the router’s top candidate model (candidateModel) for correlation.
Show a summary per file
File Description
extensions/copilot/src/platform/endpoint/node/automodeService.ts Emits new model-selection telemetry and propagates router candidate model out of router selection.

Copilot's findings

Comments suppressed due to low confidence (2)

extensions/copilot/src/platform/endpoint/node/automodeService.ts:235

  • overrideReason includes a defaultFallback branch, but routerResult.candidateModel is only set in _tryRouterSelection when the router also produced a matching selectedModel (success path). In the router-fallback/default-selection paths (emptyCandidateList, noMatchingEndpoint, routerFallback, etc.) candidateModel is currently omitted, so this event never fires and defaultFallback is effectively unreachable. Consider propagating candidateModel whenever the router returns candidate_models[0] (even if you later fall back to _selectDefaultModel), and emitting this event whenever a router recommendation exists so candidateModel vs actualModel can be compared for default-selection fallbacks as described in the PR.
		if (!skipRouter && routerResult.candidateModel) {
			/* __GDPR__
				"automode.routerModelSelection" : {
					"owner": "aashnagarg",
					"comment": "Reports the router's recommended model vs the actual model used after all client-side overrides (same-provider, vision fallback, default selection)",
					"conversationId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The conversation ID" },
					"candidateModel": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The router's top candidate model (candidate_models[0])" },
					"actualModel": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The model actually selected after all client-side overrides" },
					"overrideReason": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Why the actual model differs from the candidate: none, visionFallback, defaultFallback, or sameProvider" }
				}
			*/
			const candidateModel = routerResult.candidateModel;
			const overrideReason = candidateModel === selectedModel.model ? 'none'
				: routerFallbackReason ? 'defaultFallback'
				: 'clientOverride';
			this._telemetryService.sendMSFTTelemetryEvent('automode.routerModelSelection', {

extensions/copilot/src/platform/endpoint/node/automodeService.ts:229

  • The GDPR metadata/comment for overrideReason lists values none, visionFallback, defaultFallback, or sameProvider, but the implementation only ever emits none, defaultFallback, or clientOverride. Please align the schema description with the actual emitted values (or update the code to emit the documented values) so downstream telemetry consumers and compliance metadata are accurate.
			/* __GDPR__
				"automode.routerModelSelection" : {
					"owner": "aashnagarg",
					"comment": "Reports the router's recommended model vs the actual model used after all client-side overrides (same-provider, vision fallback, default selection)",
					"conversationId": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The conversation ID" },
					"candidateModel": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The router's top candidate model (candidate_models[0])" },
					"actualModel": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "The model actually selected after all client-side overrides" },
					"overrideReason": { "classification": "SystemMetaData", "purpose": "FeatureInsight", "comment": "Why the actual model differs from the candidate: none, visionFallback, defaultFallback, or sameProvider" }
				}
  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread extensions/copilot/src/platform/endpoint/node/automodeService.ts
Emits a new telemetry event after all client-side model overrides
(same-provider, vision fallback, default selection) are applied.

Properties:
- candidateModel: the router's top pick (candidate_models[0])
- actualModel: the model actually used after all overrides
- overrideReason: none, defaultFallback, or clientOverride
- conversationId: for correlation

This enables accurate switch attribution without fragile cross-event
joins. The existing automode.routerDecision event captures the router's
recommendation, but doesn't know what model was ultimately selected
because vision fallback and default selection happen afterward.

Analysts can now query automode.routerModelSelection directly:
  | where candidateModel != actualModel
  | summarize count() by candidateModel, actualModel
@aashna aashna force-pushed the aashnagarg/actual-model-telemetry branch from c72380d to ff47e16 Compare April 15, 2026 23:23
@aashna aashna requested a review from luabud April 15, 2026 23:23
const overrideReason = candidateModel === selectedModel.model ? 'none'
: routerFallbackReason ? 'defaultFallback'
: 'clientOverride';
this._telemetryService.sendMSFTTelemetryEvent('automode.routerModelSelection', {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll also try and check the feasibility of my comment when I have the time, but is it not possible to just pipe actualModel to the github.copilot-chat/automode.routerdecision event?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we need Logan's input on this, but I think moving the emission of github.copilot-chat/automode.routerdecision out of the fetcher object and into here may just be cleanest.

If we have two separate events for basically the same thing, that might get confusing as well.

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