@@ -282,7 +282,8 @@ describe('ClaudeCliRuntime abort force-kill fallback', () => {
282282 it ( 'settles cleanly when an interrupt ends a fenced background wait' , async ( ) => {
283283 const runtime = createRuntime ( ) ;
284284 const ctrl = createControllableProc ( ) ;
285- spawnMock . mockReturnValue ( ctrl . proc ) ;
285+ const nextCtrl = createControllableProc ( ) ;
286+ spawnMock . mockReturnValueOnce ( ctrl . proc ) . mockReturnValueOnce ( nextCtrl . proc ) ;
286287 const failures = [ ] ;
287288 const finishes = [ ] ;
288289 runtime . onFailed ( ( chatId , message ) => failures . push ( { chatId, message } ) ) ;
@@ -321,10 +322,21 @@ describe('ClaudeCliRuntime abort force-kill fallback', () => {
321322
322323 ctrl . push ( IDLE ) ;
323324 await turn ;
325+ await flush ( ) ;
324326 expect ( cleared ) . toContain ( completionFallback . id ) ;
325327 expect ( ctrl . proc . killed ) . toBe ( false ) ;
328+ expect ( ctrl . proc . ended ) . toBe ( true ) ;
326329 expect ( failures ) . toEqual ( [ ] ) ;
327330 expect ( finishes ) . toEqual ( [ { chatId : 'chat-1' , exitCode : 0 } ] ) ;
331+
332+ const nextTurn = runtime . runClaudeTurn ( startOptions ( { command : 'after stop' } ) ) ;
333+ await flush ( ) ;
334+ nextCtrl . push ( INIT ) ;
335+ nextCtrl . startLatestInput ( ) ;
336+ nextCtrl . push ( { type : 'assistant' , content : [ { type : 'text' , text : 'continued' } ] } ) ;
337+ settleTurn ( nextCtrl ) ;
338+ await nextTurn ;
339+ expect ( spawnMock ) . toHaveBeenCalledTimes ( 2 ) ;
328340 } ) ;
329341
330342 it ( 'cancels a queued submitted input when an internal turn is interrupted' , async ( ) => {
0 commit comments