@@ -469,7 +469,7 @@ describe("tui-event-handlers: handleAgentEvent", () => {
469469 } ) ;
470470
471471 it ( "keeps a local BTW result visible when its empty final chat event arrives" , ( ) => {
472- const { state, btw, loadHistory, noteLocalBtwRunId, handleBtwEvent, handleChatEvent } =
472+ const { state, btw, loadHistory, noteLocalBtwRunId, tui , handleBtwEvent, handleChatEvent } =
473473 createHandlersHarness ( {
474474 state : { activeChatRunId : null } ,
475475 } ) ;
@@ -482,6 +482,7 @@ describe("tui-event-handlers: handleAgentEvent", () => {
482482 question : "what changed?" ,
483483 text : "nothing important" ,
484484 } satisfies BtwEvent ) ;
485+ tui . requestRender . mockClear ( ) ;
485486
486487 handleChatEvent ( {
487488 runId : "run-btw" ,
@@ -495,6 +496,7 @@ describe("tui-event-handlers: handleAgentEvent", () => {
495496 text : "nothing important" ,
496497 isError : undefined ,
497498 } ) ;
499+ expect ( tui . requestRender ) . toHaveBeenCalledWith ( true ) ;
498500 } ) ;
499501
500502 it ( "clears stale streaming for a local BTW empty final without hiding the result" , ( ) => {
@@ -701,6 +703,25 @@ describe("tui-event-handlers: handleAgentEvent", () => {
701703 expect ( loadHistory ) . toHaveBeenCalledTimes ( 1 ) ;
702704 } ) ;
703705
706+ it ( "forces render when a command final only adds system text" , ( ) => {
707+ const { state, chatLog, tui, handleChatEvent } = createHandlersHarness ( {
708+ state : { activeChatRunId : "run-command" } ,
709+ } ) ;
710+
711+ handleChatEvent ( {
712+ runId : "run-command" ,
713+ sessionKey : state . currentSessionKey ,
714+ state : "final" ,
715+ message : {
716+ command : true ,
717+ content : [ { type : "text" , text : "/status done" } ] ,
718+ } ,
719+ } ) ;
720+
721+ expect ( chatLog . addSystem ) . toHaveBeenCalledWith ( "/status done" ) ;
722+ expect ( tui . requestRender ) . toHaveBeenCalledWith ( true ) ;
723+ } ) ;
724+
704725 it ( "binds optimistic pending messages to the first gateway run id and skips history reload" , ( ) => {
705726 const { state, loadHistory, isLocalRunId, handleChatEvent } = createHandlersHarness ( {
706727 state : { activeChatRunId : null , pendingOptimisticUserMessage : true } ,
@@ -1127,7 +1148,7 @@ describe("tui-event-handlers: handleAgentEvent", () => {
11271148 } ) ;
11281149
11291150 it ( "reloads history when a local run ends without a displayable final message" , ( ) => {
1130- const { state, loadHistory, noteLocalRunId, handleChatEvent } = createHandlersHarness ( {
1151+ const { state, loadHistory, noteLocalRunId, tui , handleChatEvent } = createHandlersHarness ( {
11311152 state : { activeChatRunId : "run-local-silent" } ,
11321153 } ) ;
11331154
@@ -1140,6 +1161,7 @@ describe("tui-event-handlers: handleAgentEvent", () => {
11401161 } ) ;
11411162
11421163 expect ( loadHistory ) . toHaveBeenCalledTimes ( 1 ) ;
1164+ expect ( tui . requestRender ) . toHaveBeenCalledWith ( true ) ;
11431165 } ) ;
11441166
11451167 it ( "does not reload history for local run with empty final when another run is active (#53115)" , ( ) => {
0 commit comments