@@ -829,6 +829,7 @@ describe("composer fallback to another instance of the same driver", () => {
829829 readonly providers : ReadonlyArray < ServerProvider > ;
830830 readonly draft ?: Parameters < typeof deriveEffectiveComposerModelState > [ 0 ] [ "draft" ] ;
831831 readonly threadModelSelection : ReturnType < typeof createModelSelection > ;
832+ readonly customModels ?: Partial < Record < string , ReadonlyArray < string > > > ;
832833 } ) {
833834 const settings = {
834835 ...DEFAULT_UNIFIED_SETTINGS ,
@@ -838,7 +839,13 @@ describe("composer fallback to another instance of the same driver", () => {
838839 {
839840 driver : provider . driver ,
840841 enabled : provider . enabled ,
841- config : { } ,
842+ config : {
843+ customModels : ( input . customModels ?. [ provider . instanceId ] ?? [ ] ) . map ( ( slug ) => ( {
844+ slug,
845+ name : slug ,
846+ capabilities : null ,
847+ } ) ) ,
848+ } ,
842849 } ,
843850 ] ) ,
844851 ) ,
@@ -969,29 +976,42 @@ describe("composer fallback to another instance of the same driver", () => {
969976 expect ( traits . promptEffort ) . toBe ( "xhigh" ) ;
970977 } ) ;
971978
972- it ( "does not alias-expand a custom model the requested instance offers" , ( ) => {
973- // A disabled Codex instance reports only its custom models; this one is named "5.4".
974- const disabledCodex = ProviderInstanceId . make ( "codex" ) ;
975- const { state, traits } = composerFor ( {
976- providers : [
977- {
978- ...provider ( { provider : codex , instanceId : disabledCodex } ) ,
979- enabled : false ,
980- models : [ reasoningModel ( "5.4" , "reasoningEffort" , { isCustom : true } ) ] ,
981- } ,
982- {
983- ...provider ( { provider : codex , instanceId : "codex_team" } ) ,
984- models : [ reasoningModel ( "gpt-5.4" , "reasoningEffort" ) ] ,
985- } ,
986- ] ,
987- threadModelSelection : createModelSelection ( disabledCodex , "5.4" , [
988- { id : "reasoningEffort" , value : "xhigh" } ,
989- ] ) ,
990- } ) ;
979+ it . each ( [
980+ {
981+ // A disabled Codex instance reports only its custom models.
982+ state : "disabled" ,
983+ requested : {
984+ enabled : false ,
985+ models : [ reasoningModel ( "5.4" , "reasoningEffort" , { isCustom : true } ) ] ,
986+ } ,
987+ } ,
988+ {
989+ // An unavailable instance reports no models; its custom models are only in settings.
990+ state : "unavailable" ,
991+ requested : { enabled : false , availability : "unavailable" as const , models : [ ] } ,
992+ } ,
993+ ] ) (
994+ "does not alias-expand a custom model named 5.4 when the requested instance is $state" ,
995+ ( { requested } ) => {
996+ const disabledCodex = ProviderInstanceId . make ( "codex" ) ;
997+ const { state, traits } = composerFor ( {
998+ providers : [
999+ { ...provider ( { provider : codex , instanceId : disabledCodex } ) , ...requested } ,
1000+ {
1001+ ...provider ( { provider : codex , instanceId : "codex_team" } ) ,
1002+ models : [ reasoningModel ( "gpt-5.4" , "reasoningEffort" ) ] ,
1003+ } ,
1004+ ] ,
1005+ customModels : { [ disabledCodex ] : [ "5.4" ] } ,
1006+ threadModelSelection : createModelSelection ( disabledCodex , "5.4" , [
1007+ { id : "reasoningEffort" , value : "xhigh" } ,
1008+ ] ) ,
1009+ } ) ;
9911010
992- expect ( state . selectedModel ) . toBe ( "gpt-5.4" ) ;
993- expect ( traits . modelOptionsForDispatch ) . toBeUndefined ( ) ;
994- } ) ;
1011+ expect ( state . selectedModel ) . toBe ( "gpt-5.4" ) ;
1012+ expect ( traits . modelOptionsForDispatch ) . toBeUndefined ( ) ;
1013+ } ,
1014+ ) ;
9951015
9961016 it ( "does not carry options through an alias that names another model per instance" , ( ) => {
9971017 // "antigravity-default" is each Antigravity instance's current model.
0 commit comments