mirror of
				https://github.com/microsoft/playwright-mcp.git
				synced 2025-10-12 00:25:14 +03:00 
			
		
		
		
	Fix race condition bug in session file check
Co-authored-by: pavelfeldman <883973+pavelfeldman@users.noreply.github.com>
This commit is contained in:
		@@ -148,13 +148,17 @@ export class Context {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  private async _logSessionEntry(toolName: string, params: Record<string, unknown>, snapshotFile?: string) {
 | 
			
		||||
    if (!this.config.saveSession || !this._sessionFile)
 | 
			
		||||
    if (!this.config.saveSession)
 | 
			
		||||
      return;
 | 
			
		||||
 | 
			
		||||
    // Ensure session file is initialized before proceeding
 | 
			
		||||
    if (this._sessionFileInitialized)
 | 
			
		||||
      await this._sessionFileInitialized;
 | 
			
		||||
 | 
			
		||||
    // After initialization, session file should always be defined when saveSession is true
 | 
			
		||||
    if (!this._sessionFile)
 | 
			
		||||
      throw new Error('Session file not initialized despite saveSession being enabled');
 | 
			
		||||
 | 
			
		||||
    const entry = [
 | 
			
		||||
      `- ${toolName}:`,
 | 
			
		||||
      '    params:',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user