Skip to content

Add auto model policy support#356

Open
jdneo wants to merge 4 commits into
mainfrom
jdneo/auto-model-policy
Open

Add auto model policy support#356
jdneo wants to merge 4 commits into
mainfrom
jdneo/auto-model-policy

Conversation

@jdneo

@jdneo jdneo commented Jul 17, 2026

Copy link
Copy Markdown
Member

fix #305

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 39119849-5c11-476e-941b-4c3574c369cf
Copilot AI review requested due to automatic review settings July 17, 2026 05:11

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.

Pull request overview

Adds support for “Auto” model GA by switching client logic to rely on the stable Auto model ID (auto) and by wiring a new policy-driven refresh path so the model inventory updates when the Auto model is enabled/disabled by org policy.

Changes:

  • Update Auto-model detection to use the stable model ID (id == "auto") instead of the display name.
  • Introduce autoModel.enabled policy plumbing (policy params → feature flag → event) and refresh model inventory on policy changes.
  • Improve model selection fallback behavior and add/expand tests covering Auto model policy behavior and event publishing.

Reviewed changes

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

Show a summary per file
File Description
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/utils/ModelUtils.java Switch Auto model detection to stable ID-based logic.
com.microsoft.copilot.eclipse.ui/src/com/microsoft/copilot/eclipse/ui/chat/services/ModelService.java Refresh models on Auto-model policy event; adjust default/fallback handling and selection persistence.
com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/utils/ModelUtilsTests.java Update/add tests to validate Auto handling is ID-based (not display-name based).
com.microsoft.copilot.eclipse.ui.test/src/com/microsoft/copilot/eclipse/ui/chat/services/ModelServiceTests.java Add UI-level tests for policy-driven model inventory refresh and deterministic fallback selection.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/protocol/policy/DidChangePolicyParams.java Add autoModel.enabled policy field + equality/hash/toString updates.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageClient.java Publish Auto model policy change event when the policy value changes.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/FeatureFlags.java Add autoModelPolicyEnabled feature flag storage.
com.microsoft.copilot.eclipse.core/src/com/microsoft/copilot/eclipse/core/events/CopilotEventConstants.java Add new event topic constant for Auto model policy changes.
com.microsoft.copilot.eclipse.core.test/src/com/microsoft/copilot/eclipse/core/lsp/CopilotLanguageClientTests.java Add test to ensure Auto-model policy event is published only on value changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 39119849-5c11-476e-941b-4c3574c369cf

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.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 39119849-5c11-476e-941b-4c3574c369cf
Comment on lines +296 to +299
if (currentActive == null || !isCurrentModelAvailable) {
// Try to restore user's preferred model if it's available in current mode
String restoredModelId = restoreActiveModel();
if (restoredModelId != null && modelsForCurrentMode.containsKey(restoredModelId)) {
ensureRealm(() -> activeModelObservable.setValue(modelsForCurrentMode.get(restoredModelId)));
String restoredModelKey = restoreActiveModel();
if (restoredModelKey != null && modelsForCurrentMode.containsKey(restoredModelKey)) {

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.

From my understanding, the fallback model persistence is skipped by design, right?

As the persisted Auto preference is only checked when the current model is unavailable, after Auto is disabled, the temporary fallback is selected; when Auto is re-enabled, that fallback is still available, so this block is skipped and Auto is never restored.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9c1d41fc-996c-4e22-aa02-8ba170779b75
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.

Auto Model GA

3 participants