@@ -24,7 +24,7 @@ import {
2424 type TuiPendingSubmit ,
2525} from "./tui-submit-state.js" ;
2626import { createEditorSubmitHandler , createSubmitBurstCoalescer } from "./tui-submit.js" ;
27- import type { SessionInfo } from "./tui-types.js" ;
27+ import type { SessionInfo , TuiOptions } from "./tui-types.js" ;
2828
2929type LoadHistoryMock = ReturnType < typeof vi . fn > & ( ( ) => Promise < void > ) ;
3030type RunAuthFlow = NonNullable < Parameters < typeof createCommandHandlers > [ 0 ] [ "runAuthFlow" ] > ;
@@ -115,7 +115,7 @@ function createHarness(params?: {
115115 activeChatRunId ?: string | null ;
116116 pendingSubmit ?: TuiPendingSubmit | null ;
117117 activityStatus ?: string ;
118- opts ?: { local ?: boolean } ;
118+ opts ?: Pick < TuiOptions , " local" | "timeoutMs" > ;
119119 currentSessionId ?: string | null ;
120120 sessionGeneration ?: number ;
121121 currentAgentId ?: string ;
@@ -565,6 +565,23 @@ describe("tui command handlers", () => {
565565 expect ( requestRender ) . toHaveBeenCalled ( ) ;
566566 } ) ;
567567
568+ it ( "scopes an explicit timeout override to one message" , async ( ) => {
569+ const { handleCommand, sendMessage, sendChat, state } = createHarness ( ) ;
570+
571+ await sendMessage ( "automatic hatch" , 300_000 ) ;
572+ state . pendingSubmit = null ;
573+ await handleCommand ( "later interactive turn" ) ;
574+
575+ expect ( sendChat ) . toHaveBeenNthCalledWith (
576+ 1 ,
577+ expect . objectContaining ( { message : "automatic hatch" , timeoutMs : 300_000 } ) ,
578+ ) ;
579+ expect ( sendChat ) . toHaveBeenNthCalledWith (
580+ 2 ,
581+ expect . objectContaining ( { message : "later interactive turn" , timeoutMs : undefined } ) ,
582+ ) ;
583+ } ) ;
584+
568585 it ( "projects the canonical pending user before chat.send is acknowledged" , async ( ) => {
569586 const deferred = createDeferred < { runId : string } > ( ) ;
570587 const sendChat = vi . fn ( ( ) => deferred . promise ) ;
0 commit comments