File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -391,6 +391,12 @@ export function resolveContextTokensForModel(params: {
391391 } ) ;
392392 const explicitProvider = params . provider ?. trim ( ) ;
393393 if ( ref ) {
394+ // Kick off background model discovery for read-only paths that
395+ // otherwise never trigger async loading (cfg + allowAsyncLoad: false).
396+ // Move this to the top of if(ref) so discovery fires for ALL resolvable
397+ // model references, not just the fallback path.
398+ void ensureContextWindowCacheLoaded ( ) ;
399+
394400 if ( explicitProvider ) {
395401 const fixedContextWindow = resolveAnthropicFixedContextWindow ( ref . provider , ref . model ) ;
396402 if ( fixedContextWindow !== undefined ) {
@@ -414,9 +420,6 @@ export function resolveContextTokensForModel(params: {
414420 return configuredWindow ;
415421 }
416422 }
417- // Kick off background model discovery for read-only paths that
418- // otherwise never trigger async loading (cfg + allowAsyncLoad: false).
419- void ensureContextWindowCacheLoaded ( ) ;
420423 }
421424
422425 // When provider is explicitly given and the model ID is bare (no slash),
You can’t perform that action at this time.
0 commit comments