@@ -757,6 +757,51 @@ describe('ACP server test', { timeout: 40_000 }, () => {
757757 } ) ;
758758 } ) ;
759759
760+ it ( 'should fallback to the model-specific effort when reasoningEffort is unsupported' , ( ) => {
761+ const result = fixture . getCodexAcpClient ( ) . createModelSelection ( mockModels , '5.2-codex' , 'low' , null ) ;
762+ expect ( result ) . toEqual ( {
763+ currentModelId : "5.2-codex" ,
764+ currentReasoningEffort : "medium" ,
765+ currentServiceTier : null ,
766+ } ) ;
767+ } ) ;
768+
769+ it ( 'should drop stale service tier when falling back to the default model' , ( ) => {
770+ const [ codexModel , defaultModel ] = mockModels as [ Model , Model ] ;
771+ const models = [
772+ {
773+ ...codexModel ,
774+ additionalSpeedTiers : [ "fast" ] ,
775+ } ,
776+ defaultModel ,
777+ ] ;
778+
779+ const result = fixture . getCodexAcpClient ( ) . createModelSelection ( models , 'unavailable-model' , 'high' , 'fast' ) ;
780+ expect ( result ) . toEqual ( {
781+ currentModelId : "5.1" ,
782+ currentReasoningEffort : "low" ,
783+ currentServiceTier : null ,
784+ } ) ;
785+ } ) ;
786+
787+ it ( 'should retain service tier when selected model supports it' , ( ) => {
788+ const [ codexModel , defaultModel ] = mockModels as [ Model , Model ] ;
789+ const models = [
790+ {
791+ ...codexModel ,
792+ additionalSpeedTiers : [ "fast" ] ,
793+ } ,
794+ defaultModel ,
795+ ] ;
796+
797+ const result = fixture . getCodexAcpClient ( ) . createModelSelection ( models , '5.2-codex' , 'high' , 'fast' ) ;
798+ expect ( result ) . toEqual ( {
799+ currentModelId : "5.2-codex" ,
800+ currentReasoningEffort : "high" ,
801+ currentServiceTier : "fast" ,
802+ } ) ;
803+ } ) ;
804+
760805 /**
761806 * Sets up a mock fixture with turnStart/awaitTurnCompleted spied on,
762807 * and a given session state. Returns the fixture and turnStart spy.
0 commit comments