Repository navigation
fix: refresh scroller layout when tool confirmation dialog is cancelled - #252
Closed
Darshan Poudel (rsd-darshan) wants to merge 8 commits into
Closed
Darshan Poudel (rsd-darshan) wants to merge 8 commits into
Darshan Poudel (rsd-darshan) wants to merge 8 commits into
Conversation
…l in picker When a BYOK model is named identically to a Copilot-native model (e.g. GPT-4.1), both dropdown items received the same ID, causing the picker to highlight both as selected simultaneously. Use a provider-prefixed picker ID for BYOK models so each item has a unique identity, and update the selection and lookup logic to match. Fixes microsoft#167
Existing internal callers pass plain model names (e.g. fallback model, custom mode event). Match by picker ID first, then fall back to model name so both call patterns keep working.
…concatenation Replaces the custom providerName + "_" + modelName concatenation with the model's existing getModelKey() method, which already produces a stable composite key used throughout the codebase. This avoids potential collisions from naive string concatenation and eliminates the blank-provider-name edge case.
…dules (microsoft#208) Replace getPickerId() wrapper with direct model.getModelKey() calls at each use site, removing the unnecessary indirection.
- setActiveModel now accepts only a composite model key (modelKey), matching the picker ID used throughout the codebase - Custom mode event handler resolves the model name to a key via findModelKeyByName() before calling setActiveModel - ModelHoverContentProvider uses model.getModelKey() directly instead of model.getModelName()
When the user cancels a subagent tool confirmation dialog, the subagent panel stays expanded at its pre-cancel height. This happens because cancelConfirmation() only calls parent.layout() (relaying the turn widget's children), but never updates the ScrolledComposite's minimum size via refreshScrollerLayout(). On the Continue path this goes unnoticed because subsequent subagent messages trigger a layout refresh; on the Cancel path no further messages arrive, so the panel is stuck. Fix by walking up the ancestor chain after parent.layout() to find the ChatContentViewer and calling refreshScrollerLayout(), which recomputes setMinHeight() and collapses the scroll area correctly. Fixes microsoft#169
Darshan Poudel (rsd-darshan)
requested review from
Zidong Lu (duzitong),
Ethan Hou (ethanyhou),
Sheng Chen (jdneo) and
xinyi-gong
as code owners
May 23, 2026 13:21
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR standardizes model selection to use the model’s composite key (modelKey) instead of display name, and fixes a UI layout issue after canceling tool confirmation.
Changes:
- Switch active model selection from
modelNametomodelKeyacross the model picker and hover UI. - Update
ModelService#setActiveModelcontract to accept a composite key and adjust call sites accordingly. - Refresh the chat scroller layout after canceling a tool confirmation so the UI collapses correctly.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
.../swt/ModelHoverContentProvider.java |
Uses modelKey when activating a model from hover actions. |
.../chat/services/ModelService.java |
Changes setActiveModel to take modelKey, adds name→key resolver, updates bindings and fallback selection. |
.../chat/ModelPickerGroupsBuilder.java |
Uses modelKey as dropdown item id to align with picker binding and activation. |
.../chat/InvokeToolConfirmationDialog.java |
Forces scroll container min-size refresh after cancellation to avoid stale expanded layout. |
Comment on lines
+334
to
+342
| private String findModelKeyByName(String modelName) { | ||
| Map<String, CopilotModel> currentModels = modelObservable.getValue(); | ||
| for (Map.Entry<String, CopilotModel> entry : currentModels.entrySet()) { | ||
| if (entry.getValue().getModelName().equals(modelName)) { | ||
| return entry.getKey(); | ||
| } | ||
| } | ||
| return null; | ||
| } |
Comment on lines
+149
to
+153
| // Resolve name to key, then activate | ||
| String modelKey = findModelKeyByName(modelName); | ||
| if (modelKey != null) { | ||
| setActiveModel(modelKey); | ||
| } |
Comment on lines
+349
to
359
| public void setActiveModel(String modelKey) { | ||
| Map<String, CopilotModel> currentModels = modelObservable.getValue(); | ||
|
|
||
| // Find model by model name and get its composite key | ||
| String compositeKey = null; | ||
| final CopilotModel model; | ||
| CopilotModel foundModel = null; | ||
|
|
||
| for (Map.Entry<String, CopilotModel> entry : currentModels.entrySet()) { | ||
| if (entry.getValue().getModelName().equals(modelName)) { | ||
| compositeKey = entry.getKey(); | ||
| foundModel = entry.getValue(); | ||
| break; | ||
| } | ||
| if (currentModels.containsKey(modelKey)) { | ||
| compositeKey = modelKey; | ||
| foundModel = currentModels.get(modelKey); | ||
| } |
Comment on lines
+248
to
+258
| // Walk up to refresh the scroll container's minimum size; without this the panel | ||
| // stays expanded at its pre-cancel height because ScrolledComposite.setMinHeight() | ||
| // is never updated when no further messages arrive after cancellation. | ||
| Composite ancestor = parent.getParent(); | ||
| while (ancestor != null && !ancestor.isDisposed()) { | ||
| if (ancestor instanceof ChatContentViewer) { | ||
| ((ChatContentViewer) ancestor).refreshScrollerLayout(); | ||
| break; | ||
| } | ||
| ancestor = ancestor.getParent(); | ||
| } |
Contributor
Author
|
Closing to reopen from a clean branch based on main — this branch accidentally included unrelated commits. |
Darshan Poudel (rsd-darshan)
deleted the
fix/subagent-panel-size-cancel-dialog
branch
May 23, 2026 14:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cancelConfirmation()callsparent.layout()(relays the turn widget's children) but never updates theScrolledComposite's minimum size viarefreshScrollerLayout()Fix
In
InvokeToolConfirmationDialog.cancelConfirmation(), afterparent.layout(), walk up the ancestor chain to findChatContentViewerand callrefreshScrollerLayout(). This recomputessetMinHeight()so the scroll area collapses correctly after cancellation.Test plan