@@ -213,6 +213,24 @@ test('read-only commands retry when completed status has no retained response',
213213 assert . equal ( mockExecuteRunnerCommandWithSession . mock . calls [ 2 ] ?. [ 2 ] . command , 'snapshot' ) ;
214214} ) ;
215215
216+ test ( 'read-only commands retry when status shows in-flight work' , async ( ) => {
217+ const session = makeRunnerSession ( { port : 8100 , ready : true } ) ;
218+
219+ mockEnsureRunnerSession . mockResolvedValue ( session ) ;
220+ mockExecuteRunnerCommandWithSession
221+ . mockRejectedValueOnce ( new AppError ( 'COMMAND_FAILED' , 'fetch failed' ) )
222+ . mockResolvedValueOnce ( { lifecycleState : 'started' } )
223+ . mockResolvedValueOnce ( { nodes : [ ] , truncated : false } ) ;
224+
225+ const result = await runIosRunnerCommand ( IOS_SIMULATOR , { command : 'snapshot' } ) ;
226+
227+ assert . deepEqual ( result , { nodes : [ ] , truncated : false } ) ;
228+ assert . equal ( mockInvalidateRunnerSession . mock . calls . length , 0 ) ;
229+ assert . equal ( mockExecuteRunnerCommandWithSession . mock . calls . length , 3 ) ;
230+ assert . equal ( mockExecuteRunnerCommandWithSession . mock . calls [ 1 ] ?. [ 2 ] . command , 'status' ) ;
231+ assert . equal ( mockExecuteRunnerCommandWithSession . mock . calls [ 2 ] ?. [ 2 ] . command , 'snapshot' ) ;
232+ } ) ;
233+
216234test ( 'mutating commands report recovery guidance when completed status has no retained response' , async ( ) => {
217235 const session = makeRunnerSession ( { port : 8100 , ready : true } ) ;
218236
0 commit comments