@@ -803,7 +803,7 @@ describe("getRooModels", () => {
803803 expect ( model . nestedConfig ) . toEqual ( { key : "value" } )
804804 } )
805805
806- it ( "should apply versioned settings when version matches" , async ( ) => {
806+ it ( "should apply versioned settings when version matches, overriding plain settings " , async ( ) => {
807807 const mockResponse = {
808808 object : "list" ,
809809 data : [
@@ -845,11 +845,65 @@ describe("getRooModels", () => {
845845
846846 const models = await getRooModels ( baseUrl , apiKey )
847847
848- // Versioned settings should be used instead of plain settings
848+ // Versioned settings should override the same properties from plain settings
849849 expect ( models [ "test/versioned-model" ] . includedTools ) . toEqual ( [ "apply_patch" , "search_replace" ] )
850850 expect ( models [ "test/versioned-model" ] . excludedTools ) . toEqual ( [ "apply_diff" , "write_to_file" ] )
851851 } )
852852
853+ it ( "should merge settings and versionedSettings, with versioned settings taking precedence" , async ( ) => {
854+ const mockResponse = {
855+ object : "list" ,
856+ data : [
857+ {
858+ id : "test/merged-settings-model" ,
859+ object : "model" ,
860+ created : 1234567890 ,
861+ owned_by : "test" ,
862+ name : "Model with Merged Settings" ,
863+ description : "Model with both settings and versionedSettings that should be merged" ,
864+ context_window : 128000 ,
865+ max_tokens : 8192 ,
866+ type : "language" ,
867+ tags : [ "tool-use" ] ,
868+ pricing : {
869+ input : "0.0001" ,
870+ output : "0.0002" ,
871+ } ,
872+ // Plain settings - provides base configuration
873+ settings : {
874+ includedTools : [ "apply_patch" ] ,
875+ excludedTools : [ "apply_diff" , "write_to_file" ] ,
876+ reasoningEffort : "medium" ,
877+ } ,
878+ // Versioned settings - adds version-specific overrides
879+ versionedSettings : {
880+ "1.0.0" : {
881+ supportsTemperature : false ,
882+ supportsReasoningEffort : [ "none" , "low" , "medium" , "high" ] ,
883+ } ,
884+ } ,
885+ } ,
886+ ] ,
887+ }
888+
889+ mockFetch . mockResolvedValueOnce ( {
890+ ok : true ,
891+ json : async ( ) => mockResponse ,
892+ } )
893+
894+ const models = await getRooModels ( baseUrl , apiKey )
895+ const model = models [ "test/merged-settings-model" ] as Record < string , unknown >
896+
897+ // Properties from plain settings should be present
898+ expect ( model . includedTools ) . toEqual ( [ "apply_patch" ] )
899+ expect ( model . excludedTools ) . toEqual ( [ "apply_diff" , "write_to_file" ] )
900+ expect ( model . reasoningEffort ) . toBe ( "medium" )
901+
902+ // Properties from versioned settings should also be present
903+ expect ( model . supportsTemperature ) . toBe ( false )
904+ expect ( model . supportsReasoningEffort ) . toEqual ( [ "none" , "low" , "medium" , "high" ] )
905+ } )
906+
853907 it ( "should use plain settings when no versioned settings version matches" , async ( ) => {
854908 const mockResponse = {
855909 object : "list" ,
0 commit comments