@@ -107,7 +107,7 @@ async function runSessionCloseTeardown(params: {
107107 }
108108 } ;
109109 const retainAppleRunner = shouldRetainAppleRunnerAfterClose ( req , session ) ;
110- await stopBestEffortSessionResources ( session , sessionStore , attemptCleanup ) ;
110+ await stopBestEffortSessionResources ( session , sessionName , sessionStore , attemptCleanup ) ;
111111 const platformCloseError = repairArmed
112112 ? undefined
113113 : await dispatchTargetedPlatformClose ( { req, session, logPath } ) ;
@@ -126,21 +126,22 @@ type CleanupRunner = (step: string, run: () => Promise<void>) => Promise<void>;
126126
127127async function stopBestEffortSessionResources (
128128 session : SessionState ,
129+ sessionName : string ,
129130 sessionStore : SessionStore ,
130131 attemptCleanup : CleanupRunner ,
131132) : Promise < void > {
132133 // Recording overlay finalization needs the Apple runner.
133- const currentSession = sessionStore . get ( session . name ) ?? session ;
134+ const currentSession = sessionStore . get ( sessionName ) ?? session ;
134135 if ( currentSession . screenRecording ) {
135136 await attemptCleanup ( 'recording' , ( ) =>
136137 finishSessionScreenRecording ( {
137138 session : currentSession ,
138- sessionName : session . name ,
139+ sessionName,
139140 sessionStore,
140141 } ) ,
141142 ) ;
142143 }
143- await attemptCleanup ( 'app_log' , ( ) => stopSessionAppLog ( { session, sessionStore } ) ) ;
144+ await attemptCleanup ( 'app_log' , ( ) => stopSessionAppLog ( { session, sessionName , sessionStore } ) ) ;
144145 await attemptCleanup ( 'audio_probe' , async ( ) => {
145146 await stopSessionAudioProbe ( session , 'session-close' ) ;
146147 } ) ;
0 commit comments