@@ -110,7 +110,9 @@ describe("ProviderCommandReactor", () => {
110110 typeof input === "object" &&
111111 input !== null &&
112112 "provider" in input &&
113- ( input . provider === "codex" || input . provider === "claudeAgent" )
113+ ( input . provider === "codex" ||
114+ input . provider === "copilot" ||
115+ input . provider === "claudeAgent" )
114116 ? input . provider
115117 : "codex" ;
116118 const resumeCursor =
@@ -552,6 +554,46 @@ describe("ProviderCommandReactor", () => {
552554 } ) ;
553555 } ) ;
554556
557+ it ( "binds a first turn to the requested provider when the model slug is shared" , async ( ) => {
558+ const harness = await createHarness ( { threadModel : "gpt-5.4" } ) ;
559+ const now = new Date ( ) . toISOString ( ) ;
560+
561+ await Effect . runPromise (
562+ harness . engine . dispatch ( {
563+ type : "thread.turn.start" ,
564+ commandId : CommandId . makeUnsafe ( "cmd-turn-start-shared-model-provider" ) ,
565+ threadId : ThreadId . makeUnsafe ( "thread-1" ) ,
566+ message : {
567+ messageId : asMessageId ( "user-message-shared-model-provider" ) ,
568+ role : "user" ,
569+ text : "hello copilot" ,
570+ attachments : [ ] ,
571+ } ,
572+ provider : "copilot" ,
573+ model : "gpt-5.4" ,
574+ interactionMode : DEFAULT_PROVIDER_INTERACTION_MODE ,
575+ runtimeMode : "approval-required" ,
576+ createdAt : now ,
577+ } ) ,
578+ ) ;
579+
580+ await waitFor ( ( ) => harness . startSession . mock . calls . length === 1 ) ;
581+ await waitFor ( ( ) => harness . sendTurn . mock . calls . length === 1 ) ;
582+
583+ expect ( harness . startSession . mock . calls [ 0 ] ?. [ 1 ] ) . toMatchObject ( {
584+ provider : "copilot" ,
585+ model : "gpt-5.4" ,
586+ } ) ;
587+ expect ( harness . sendTurn . mock . calls [ 0 ] ?. [ 0 ] ) . toMatchObject ( {
588+ threadId : ThreadId . makeUnsafe ( "thread-1" ) ,
589+ model : "gpt-5.4" ,
590+ } ) ;
591+
592+ const readModel = await Effect . runPromise ( harness . engine . getReadModel ( ) ) ;
593+ const thread = readModel . threads . find ( ( entry ) => entry . id === ThreadId . makeUnsafe ( "thread-1" ) ) ;
594+ expect ( thread ?. session ?. providerName ) . toBe ( "copilot" ) ;
595+ } ) ;
596+
555597 it ( "rejects a turn when the requested model belongs to a different provider" , async ( ) => {
556598 const harness = await createHarness ( ) ;
557599 const now = new Date ( ) . toISOString ( ) ;
0 commit comments