@@ -320,6 +320,40 @@ describe("mobile task permissions", () => {
320320} ) ;
321321
322322describe ( "queued follow-up model" , ( ) => {
323+ it ( "queues an unpicked follow-up despite an unavailable cached thread model" , async ( ) => {
324+ state . grantedEnvironments . add ( "secondary" ) ;
325+ state . serverConfig = {
326+ ...state . serverConfig ,
327+ providers : [ { instanceId : "codex" , driver : "codex" , enabled : false } ] ,
328+ } as unknown as ServerConfig ;
329+
330+ expect ( await useThreadComposerState ( ) . onSendMessage ( ) ) . toBe ( "message" ) ;
331+
332+ expect ( state . enqueue ) . toHaveBeenCalledExactlyOnceWith (
333+ expect . objectContaining ( { text : "Keep my draft" , threadId : "thread" } ) ,
334+ ) ;
335+ const [ queued ] = state . enqueue . mock . calls [ 0 ] as unknown as [ object ] ;
336+ expect ( queued ) . not . toHaveProperty ( "modelSelection" ) ;
337+ expect ( state . clearDraft ) . toHaveBeenCalledOnce ( ) ;
338+ } ) ;
339+
340+ it ( "preserves an explicit unavailable pick instead of queueing it" , async ( ) => {
341+ state . grantedEnvironments . add ( "secondary" ) ;
342+ state . serverConfig = {
343+ ...state . serverConfig ,
344+ providers : [ { instanceId : "codex" , driver : "codex" , enabled : false } ] ,
345+ } as unknown as ServerConfig ;
346+ state . draft . modelSelection = {
347+ instanceId : ProviderInstanceId . make ( "codex" ) ,
348+ model : "gpt-5.4" ,
349+ } ;
350+
351+ expect ( await useThreadComposerState ( ) . onSendMessage ( ) ) . toBeNull ( ) ;
352+
353+ expect ( state . enqueue ) . not . toHaveBeenCalled ( ) ;
354+ expect ( state . clearDraft ) . not . toHaveBeenCalled ( ) ;
355+ } ) ;
356+
323357 it ( "queues a follow-up with no model when the user picked none" , async ( ) => {
324358 state . grantedEnvironments . add ( "secondary" ) ;
325359 const composer = useThreadComposerState ( ) ;
0 commit comments