@@ -2612,9 +2612,42 @@ describe("ProviderCommandReactor", () => {
26122612 expect ( thread ?. session ?. threadId ) . toBe ( "thread-1" ) ;
26132613 expect ( thread ?. session ?. providerName ) . toBe ( "claudeAgent" ) ;
26142614 expect ( thread ?. session ?. providerInstanceId ) . toBe ( "claudeAgent" ) ;
2615+ expect ( thread ?. modelSelection ) . toMatchObject ( {
2616+ instanceId : ProviderInstanceId . make ( "claudeAgent" ) ,
2617+ model : "claude-opus-4-6" ,
2618+ } ) ;
26152619 expect (
26162620 thread ?. activities . find ( ( activity ) => activity . kind === "provider.turn.start.failed" ) ,
26172621 ) . toBeUndefined ( ) ;
2622+
2623+ // Subsequent turn without modelSelection should continue on the switched provider
2624+ await Effect . runPromise (
2625+ harness . engine . dispatch ( {
2626+ type : "thread.turn.start" ,
2627+ commandId : CommandId . make ( "cmd-turn-start-provider-switch-3" ) ,
2628+ threadId : ThreadId . make ( "thread-1" ) ,
2629+ message : {
2630+ messageId : asMessageId ( "user-message-provider-switch-3" ) ,
2631+ role : "user" ,
2632+ text : "third turn without modelSelection" ,
2633+ attachments : [ ] ,
2634+ } ,
2635+ interactionMode : DEFAULT_PROVIDER_INTERACTION_MODE ,
2636+ runtimeMode : "approval-required" ,
2637+ createdAt : now ,
2638+ } ) ,
2639+ ) ;
2640+
2641+ await waitFor ( ( ) => harness . sendTurn . mock . calls . length === 3 ) ;
2642+ const thirdTurnInput = harness . sendTurn . mock . calls [ 2 ] ?. [ 0 ] as
2643+ | {
2644+ modelSelection ?: ModelSelection ;
2645+ input ?: string ;
2646+ }
2647+ | undefined ;
2648+ expect ( thirdTurnInput ?. input ) . toBe ( "third turn without modelSelection" ) ;
2649+ // Ensure it stayed with claudeAgent and did not revert to codex
2650+ expect ( harness . startSession . mock . calls . length ) . toBe ( 2 ) ;
26182651 } ) ;
26192652
26202653 it ( "retries provider continuity context after a failed switched-provider turn" , async ( ) => {
0 commit comments