@@ -895,6 +895,49 @@ func getSystemMessage(exchange testharness.ParsedHttpExchange) string {
895895 return ""
896896}
897897
898+ func TestSetModelWithReasoningEffort (t * testing.T ) {
899+ ctx := testharness .NewTestContext (t )
900+ client := ctx .NewClient ()
901+ t .Cleanup (func () { client .ForceStop () })
902+
903+ if err := client .Start (t .Context ()); err != nil {
904+ t .Fatalf ("Failed to start client: %v" , err )
905+ }
906+
907+ session , err := client .CreateSession (t .Context (), & copilot.SessionConfig {
908+ OnPermissionRequest : copilot .PermissionHandler .ApproveAll ,
909+ })
910+ if err != nil {
911+ t .Fatalf ("Failed to create session: %v" , err )
912+ }
913+
914+ modelChanged := make (chan copilot.SessionEvent , 1 )
915+ session .On (func (event copilot.SessionEvent ) {
916+ if event .Type == copilot .SessionModelChange {
917+ select {
918+ case modelChanged <- event :
919+ default :
920+ }
921+ }
922+ })
923+
924+ if err := session .SetModel (t .Context (), "gpt-4.1" , copilot.SetModelOptions {ReasoningEffort : "high" }); err != nil {
925+ t .Fatalf ("SetModel returned error: %v" , err )
926+ }
927+
928+ select {
929+ case evt := <- modelChanged :
930+ if evt .Data .NewModel == nil || * evt .Data .NewModel != "gpt-4.1" {
931+ t .Errorf ("Expected newModel 'gpt-4.1', got %v" , evt .Data .NewModel )
932+ }
933+ if evt .Data .ReasoningEffort == nil || * evt .Data .ReasoningEffort != "high" {
934+ t .Errorf ("Expected reasoningEffort 'high', got %v" , evt .Data .ReasoningEffort )
935+ }
936+ case <- time .After (30 * time .Second ):
937+ t .Fatal ("Timed out waiting for session.model_change event" )
938+ }
939+ }
940+
898941func getToolNames (exchange testharness.ParsedHttpExchange ) []string {
899942 var names []string
900943 for _ , tool := range exchange .Request .Tools {
0 commit comments