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
Summary
The
customModeModelChangedEventHandlerinModelServiceresolves the model to activate by searching for the first map entry whosegetModelName()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,findModelKeyByNamereturns 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
customModeModelChangedEventHandlercan do an unambiguous direct map lookup.Related