microsoft / microsoft/copilot-for-eclipse
customModeModelChangedEventHandler may activate wrong model when BYOK and native models share a name
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 126
- Forks
- 60
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 5
Description
Summary
The customModeModelChangedEventHandler in ModelService resolves the model to activate by searching for the first map entry whose getModelName() matches the name extracted from the event payload (format: "<modelName> (<modelFamily>)").
If a BYOK model and a native Copilot model happen to share the same modelName, findModelKeyByName returns the first match regardless of provider, which can activate the wrong model.
Root cause
The custom-mode event protocol carries only a human-readable model name (plus family in parens). There is no provider or composite key in the payload, so a name-only lookup is inherently ambiguous when models share a name across providers.
Fix
Extend the custom-mode event protocol to carry the composite key (or at minimum the provider name alongside the model name), so customModeModelChangedEventHandler can do an unambiguous direct map lookup.
Related
- PR #246 (fixes the model-picker collision; this is a residual edge case in the custom-mode path)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ModelService at customModeModelChangedEventHandler and findModelKeyByName, then trace the custom-mode event protocol and review PR #246 for the related model-picker collision fix. The work is complete when the event carries enough provider or composite-key information for an unambiguous direct lookup, including when BYOK and native models share a name.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100