File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,20 @@ export async function modelsStatusCommand(
9595 const rawDefaultsModel = resolveAgentModelPrimaryValue ( cfg . agents ?. defaults ?. model ) ?? "" ;
9696 const rawModel = agentModelPrimary ?? rawDefaultsModel ;
9797 const resolvedLabel = `${ resolved . provider } /${ resolved . model } ` ;
98- const defaultLabel = rawModel || resolvedLabel ;
98+ // Validate that rawModel's provider still exists in config before using it;
99+ // otherwise fall back to the properly resolved label (prevents stale provider names).
100+ const rawModelProviderValid = ( ( ) => {
101+ if ( ! rawModel ) {
102+ return false ;
103+ }
104+ const parsed = parseModelRef ( rawModel , DEFAULT_PROVIDER ) ;
105+ if ( ! parsed ?. provider ) {
106+ return false ;
107+ }
108+ const configProviders = cfg . models ?. providers ?? { } ;
109+ return parsed . provider in configProviders ;
110+ } ) ( ) ;
111+ const defaultLabel = rawModelProviderValid ? rawModel : resolvedLabel ;
99112 const defaultsFallbacks = resolveAgentModelFallbackValues ( cfg . agents ?. defaults ?. model ) ;
100113 const fallbacks = agentFallbacksOverride ?? defaultsFallbacks ;
101114 const imageModel = resolveAgentModelPrimaryValue ( cfg . agents ?. defaults ?. imageModel ) ?? "" ;
You can’t perform that action at this time.
0 commit comments