@@ -14,8 +14,6 @@ const tmuxFake = vi.hoisted(() => ({
1414 on : false ,
1515 /** Panes a run was stopped in, in order. */
1616 stopped : [ ] as string [ ] ,
17- /** Every stop the service asked for, whether or not the pane was still the run's. */
18- attempted : [ ] as string [ ] ,
1917 /** Panes no longer the run's (closed by the user, or reused after a tmux restart). */
2018 gone : new Set < string > ( ) ,
2119 statusPaths : new Map < string , string > ( ) ,
@@ -55,7 +53,6 @@ vi.mock('@/main/terminal/tmux', async () => {
5553 stopRun : async ( ...args : Parameters < typeof actual . stopRun > ) => {
5654 if ( ! tmuxFake . on ) return actual . stopRun ( ...args )
5755 const [ handle ] = args
58- tmuxFake . attempted . push ( handle . pane )
5956 if ( tmuxFake . gone . has ( handle . pane ) ) return
6057 tmuxFake . stopped . push ( handle . pane )
6158 writeFileSync ( handle . statusPath , '130' )
@@ -663,31 +660,4 @@ describe('agent commands in tmux', () => {
663660 tmuxFake . on = false
664661 }
665662 } )
666-
667- it ( "forgets a closed tab's run once its pane is gone" , async ( ) => {
668- tmuxFake . on = true
669- tmuxFake . statusPaths . clear ( )
670- tmuxFake . stopped . length = 0
671- try {
672- const terminal = new TerminalService ( { loadCwd : ( ) => '/tmp' } )
673- const { activeTerminalId } = terminal . start ( { cols : 80 , rows : 24 } )
674- await terminal . executeTool ( 'call-orphan' , 'run' , { command : 'sleep 1' , waitSeconds : 1 } )
675- const [ orphanPane ] = [ ...tmuxFake . statusPaths . keys ( ) ]
676- terminal . closeTerminal ( activeTerminalId as string )
677- // Its command ended and tmux closed its pane.
678- tmuxFake . gone . add ( orphanPane ?? '' )
679-
680- // The next run's bookkeeping drops it, so sign-out has nothing left to stop.
681- await terminal . executeTool ( 'call-new' , 'new' , { } )
682- await terminal . executeTool ( 'call-next' , 'run' , { command : 'ls' , waitSeconds : 1 } )
683- tmuxFake . gone . add ( [ ...tmuxFake . statusPaths . keys ( ) ] [ 1 ] ?? '' )
684- tmuxFake . attempted . length = 0
685- await terminal . stopAgentCommands ( )
686-
687- expect ( tmuxFake . attempted ) . not . toContain ( orphanPane )
688- } finally {
689- tmuxFake . on = false
690- tmuxFake . gone . clear ( )
691- }
692- } )
693663} )
0 commit comments