@@ -113,6 +113,55 @@ describe("CopilotClient", () => {
113113 spy . mockRestore ( ) ;
114114 } ) ;
115115
116+ it ( "sends session.model.switchTo RPC with reasoningEffort when provided" , async ( ) => {
117+ const client = new CopilotClient ( ) ;
118+ await client . start ( ) ;
119+ onTestFinished ( ( ) => client . forceStop ( ) ) ;
120+
121+ const session = await client . createSession ( { onPermissionRequest : approveAll } ) ;
122+
123+ // Mock sendRequest to capture the call without hitting the runtime
124+ const spy = vi
125+ . spyOn ( ( client as any ) . connection ! , "sendRequest" )
126+ . mockImplementation ( async ( method : string , _params : any ) => {
127+ if ( method === "session.model.switchTo" ) return { } ;
128+ throw new Error ( `Unexpected method: ${ method } ` ) ;
129+ } ) ;
130+
131+ await session . setModel ( "gpt-4.1" , "high" ) ;
132+
133+ expect ( spy ) . toHaveBeenCalledWith ( "session.model.switchTo" , {
134+ sessionId : session . sessionId ,
135+ modelId : "gpt-4.1" ,
136+ reasoningEffort : "high" ,
137+ } ) ;
138+
139+ spy . mockRestore ( ) ;
140+ } ) ;
141+
142+ it ( "sends session.model.switchTo RPC without reasoningEffort when not provided" , async ( ) => {
143+ const client = new CopilotClient ( ) ;
144+ await client . start ( ) ;
145+ onTestFinished ( ( ) => client . forceStop ( ) ) ;
146+
147+ const session = await client . createSession ( { onPermissionRequest : approveAll } ) ;
148+
149+ // Mock sendRequest to capture the call without hitting the runtime
150+ const spy = vi
151+ . spyOn ( ( client as any ) . connection ! , "sendRequest" )
152+ . mockImplementation ( async ( method : string , params : any ) => {
153+ if ( method === "session.model.switchTo" ) return { } ;
154+ throw new Error ( `Unexpected method: ${ method } ` ) ;
155+ } ) ;
156+
157+ await session . setModel ( "gpt-4.1" ) ;
158+
159+ const callArgs = spy . mock . calls [ 0 ] [ 1 ] as Record < string , unknown > ;
160+ expect ( callArgs ) . not . toHaveProperty ( "reasoningEffort" ) ;
161+
162+ spy . mockRestore ( ) ;
163+ } ) ;
164+
116165 describe ( "URL parsing" , ( ) => {
117166 it ( "should parse port-only URL format" , ( ) => {
118167 const client = new CopilotClient ( {
0 commit comments