close
Skip to content

Fix bugs related to setting the right Chat model. (Fixes Issue #323765)#323767

Merged
Giuspepe merged 5 commits into
microsoft:mainfrom
danielrobbins:drobbins/preserve-chat-retry-model-configuration
Jul 10, 2026
Merged

Fix bugs related to setting the right Chat model. (Fixes Issue #323765)#323767
Giuspepe merged 5 commits into
microsoft:mainfrom
danielrobbins:drobbins/preserve-chat-retry-model-configuration

Conversation

@danielrobbins

Copy link
Copy Markdown
Contributor

This patch was originally created to address a bug where encountering an error and a "Try Again" button in the Chat window does not allow a different model to be selected, preventing the user from switching to a working model.

Upon investigation, multiple inconsistencies were found related to feeding the model selection widget's current state in various places. This patch centralizes this in getSelectedModelRequestOptions() to avoid needing to keep multiple call sites in sync going forward.

More specifically, several resend and confirmation paths passed only the selected model ID. That can drop editor-scoped model configuration, such as custom per-model settings, and cause follow-up requests to use configuration that does not match the visible model picker state. The new helper keeps the selected model ID and its scoped configuration together whenever the widget builds Chat request options.

To test: Select a third-party endpoint for a new chat, then successfully use it. Now, simulate an error on the endpoint, so that it will return an error to Chat on the next request. Now, attempt to continue with a new turn in Chat, resulting in an error from the endpoint. Chat will display a "Try Again" button. Now, pretend you are a user needing to select a working Model since your current model experienced an error. Before pressing "Try Again", select a new model, then hit "Try Again". With the patch, the new model will be utilized. Without the patch, the original failing model will continue to be selected, the original prompt will be re-submitted, and is likely to re-trigger the same error if the error was related to prompt content, size, quota, etc.

Copilot AI review requested due to automatic review settings June 30, 2026 19:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@danielrobbins

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree company="BreezyOps, Inc."

@danielrobbins danielrobbins changed the title Fix bugs related to setting the right Chat model. (#323765) Fix bugs related to setting the right Chat model. (Fixes Issue #323765) Jun 30, 2026
@danielrobbins
danielrobbins force-pushed the drobbins/preserve-chat-retry-model-configuration branch from 9604293 to fcfd103 Compare June 30, 2026 20:46
This patch was originally created to address a bug where a Try Again in
the Chat window would not allow a different model to be selected.

Multiple inconsistencies were found related to feeding the model
selection widget's current state in various places. This patch
centralizes this in getSelectedModelRequestOptions() to avoid needing to
keep multiple call sites in sync going forward.

More specifically, several resend and confirmation paths passed only the
selected model ID. That can drop editor-scoped model configuration, such
as custom per-model settings, and cause follow-up requests to use
configuration that does not match the visible model picker state. The
new helper keeps the selected model ID and its scoped configuration
together whenever the widget builds Chat request options.

Fixes microsoft#323765
@danielrobbins
danielrobbins force-pushed the drobbins/preserve-chat-retry-model-configuration branch from fcfd103 to d2f679c Compare June 30, 2026 20:47
@Giuspepe

Giuspepe commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Thanks for your PR! Fixes #323765

Giuspepe
Giuspepe previously approved these changes Jul 3, 2026
alexdima
alexdima previously approved these changes Jul 3, 2026
roblourens
roblourens previously approved these changes Jul 3, 2026
@Giuspepe
Giuspepe enabled auto-merge July 6, 2026 13:39
@Giuspepe

Giuspepe commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@danielrobbins looks like you have some tests failing

@danielrobbins

Copy link
Copy Markdown
Contributor Author

@Giuspepe Ah, yes I do. Looks like a test fixture needs updating to reflect the changes. Should have time to get that fixed today.

Ensure the RetryChatAction test widget mock implements the selected model request-options helper and assert retry preserves the selected model id and scoped model configuration.
auto-merge was automatically disabled July 7, 2026 15:38

Head branch was pushed to by a user without write access

@danielrobbins
danielrobbins dismissed stale reviews from alexdima, Giuspepe, and roblourens via 12797aa July 7, 2026 15:38
@danielrobbins

Copy link
Copy Markdown
Contributor Author

Should do better now on the tests.

@danielrobbins

Copy link
Copy Markdown
Contributor Author

I updated the PR after the previous test failure and the branch is mergeable again. This should be ready to go, @Giuspepe

@Giuspepe
Giuspepe enabled auto-merge July 10, 2026 10:23
@Giuspepe
Giuspepe merged commit b7e56e6 into microsoft:main Jul 10, 2026
29 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.129.0 milestone Jul 10, 2026
@Giuspepe

Copy link
Copy Markdown
Contributor

Thanks a lot again for your contribution @danielrobbins :)

@danielrobbins

Copy link
Copy Markdown
Contributor Author

@Giuspepe you are welcome! I also have another pretty important fix for BYOK here that needs merging: #324311

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.

7 participants