Skip to content

Fix optional chaining on candidate_models in routerDecision telemetry#310008

Merged
aashna merged 2 commits into
mainfrom
aashnagarg/fix-candidate-models-optional-chaining
Apr 15, 2026
Merged

Fix optional chaining on candidate_models in routerDecision telemetry#310008
aashna merged 2 commits into
mainfrom
aashnagarg/fix-candidate-models-optional-chaining

Conversation

@aashna
Copy link
Copy Markdown
Contributor

@aashna aashna commented Apr 14, 2026

result.candidate_models[0] throws a TypeError if the router returns a response without candidate_models, crashing the entire sendMSFTTelemetryEvent call and losing all fields on the event.

Use optional chaining (candidate_models?.[0]) so it safely falls back to the empty string default.

result.candidate_models[0] throws a TypeError if the router returns a
response without candidate_models, crashing the entire
sendMSFTTelemetryEvent call and losing all fields on the event.

Use optional chaining (candidate_models?.[0]) so it safely falls back
to the empty string default.
@aashna aashna requested review from bhavyaus, Copilot and lramos15 April 14, 2026 22:36
@aashna aashna enabled auto-merge April 14, 2026 22:36
@aashna aashna requested a review from luabud April 14, 2026 22:39
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

Note

Copilot was unable to run its full agentic suite in this review.

Prevents a telemetry crash when the router response omits candidate_models by safely accessing the first candidate model via optional chaining.

Changes:

  • Replaced direct array indexing on result.candidate_models[0] with optional chaining result.candidate_models?.[0] to avoid TypeError when candidate_models is undefined.
Show a summary per file
File Description
extensions/copilot/src/platform/endpoint/node/routerDecisionFetcher.ts Makes candidateModel telemetry extraction resilient to missing candidate_models responses.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@github-actions
Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: bfc9f24e Current: 139166f4

Changed (26)

chat/aiCustomizations/aiCustomizationManagementEditor/McpBrowseMode/Light
Before After
before after
editor/inlineCompletions/other/JumpToHint/Dark
Before After
before after
agentSessionsViewer/CompletedRead/Dark
Before After
before after
agentSessionsViewer/CompletedUnread/Dark
Before After
before after
agentSessionsViewer/FailedWithDuration/Dark
Before After
before after
agentSessionsViewer/WithDiffChanges/Light
Before After
before after
agentSessionsViewer/WithBadge/Dark
Before After
before after
agentSessionsViewer/WithBadgeAndDiff/Light
Before After
before after
agentSessionsViewer/BackgroundProvider/Dark
Before After
before after
agentSessionsViewer/FailedWithDuration/Light
Before After
before after
agentSessionsViewer/WithFileChangesList/Dark
Before After
before after
agentSessionsViewer/WithMarkdownBadge/Light
Before After
before after
agentSessionsViewer/FailedWithoutDuration/Dark
Before After
before after
agentSessionsViewer/WithMarkdownBadge/Dark
Before After
before after
agentSessionsViewer/WithBadgeAndDiff/Dark
Before After
before after
agentSessionsViewer/CompletedRead/Light
Before After
before after
agentSessionsViewer/FailedWithoutDuration/Light
Before After
before after
agentSessionsViewer/WithBadge/Light
Before After
before after
agentSessionsViewer/CloudProvider/Light
Before After
before after
agentSessionsViewer/ClaudeProvider/Dark
Before After
before after
agentSessionsViewer/CompletedUnread/Light
Before After
before after
agentSessionsViewer/WithDiffChanges/Dark
Before After
before after
agentSessionsViewer/WithFileChangesList/Light
Before After
before after
agentSessionsViewer/CloudProvider/Dark
Before After
before after
agentSessionsViewer/BackgroundProvider/Light
Before After
before after
agentSessionsViewer/ClaudeProvider/Light
Before After
before after

@aashna aashna merged commit 5938681 into main Apr 15, 2026
26 checks passed
@aashna aashna deleted the aashnagarg/fix-candidate-models-optional-chaining branch April 15, 2026 01:07
@vs-code-engineering vs-code-engineering Bot added this to the 1.117.0 milestone Apr 15, 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.

4 participants