Skip to content

[Bug] Windsurf IDE deletes Playwright cache on WSL connection (ignores PLAYWRIGHT_SKIP_BROWSER_GC) #323

@d-takioka

Description

@d-takioka

Bug Report: Windsurf IDE Deletes Playwright Cache on WSL Connection

Summary

Windsurf IDE's Language Server (language_server_linux_x64) automatically deletes the Playwright cache directory (~/.cache/ms-playwright/) when connecting to WSL2, even when PLAYWRIGHT_SKIP_BROWSER_GC=1 is set. This causes Playwright browsers to be reinstalled on every IDE restart, wasting time and bandwidth.

Environment

  • OS: WSL2 (Ubuntu on Windows)
  • Windsurf Version: 2.1.32
  • Codeium Version: Latest
  • Playwright Version: 1.40.0+
  • Package Manager: uv

Installed Extensions (WSL)

anthropic.claude-code
continue.continue
eamodio.gitlens
editorconfig.editorconfig
evidence.sqltools-duckdb-driver
golang.go
ionutvmi.path-autocomplete
mads-hartmann.bash-ide-vscode
mhutchie.git-graph
mohsen1.prettify-json
moshfeu.compare-folders
ms-azuretools.vscode-containers
ms-azuretools.vscode-docker
ms-ceintl.vscode-language-pack-ja
ms-vscode.live-server
mtxr.sqltools
orta.vscode-jest
paragdiwan.gitpatch
randomfractalsinc.duckdb-sql-tools
redhat.java
shd101wyy.markdown-preview-enhanced

Note: The issue occurs with Windsurf's built-in MCP server functionality.

Problem Description

When Windsurf IDE connects to WSL2, the Language Server process (PID ) executes a cache cleanup operation that removes the entire Playwright cache directory at ~/.cache/ms-playwright/. This happens regardless of Playwright's PLAYWRIGHT_SKIP_BROWSER_GC=1 environment variable setting.

Evidence

Log from Language Server:

2026-05-05 13:55:37.879 [info] I0505 13:55:37.879531 <PID> server.go:288] Successfully removed Playwright cache directory: /home/<USER>/.cache/ms-playwright

Process Information:

  • PID: (redacted)
  • Process: /home/<USER>/.windsurf-server/bin/<HASH>/extensions/windsurf/bin/language_server_linux_x64
  • Parent PID: <PARENT_PID> (bootstrap-fork / extensionHost)

File System Events (inotify):

  • Deletion started: 2026-05-05 13:46:27
  • Deletion completed: 2026-05-05 13:46:59
  • Total files deleted: 643

Reproduction Steps

  1. Install Playwright browsers (any method that creates ~/.cache/ms-playwright/):

    playwright install chromium
    # or
    uv run install-browsers
  2. Verify cache exists:

    ls -la ~/.cache/ms-playwright/
  3. Close Windsurf IDE

  4. Start Windsurf IDE and connect to WSL2

  5. Check cache directory:

    ls -la ~/.cache/ms-playwright/
    # Output: ls: cannot access '/home/<USER>/.cache/ms-playwright/': No such file or directory

Expected Behavior

The Playwright cache directory should persist across Windsurf IDE restarts, especially when PLAYWRIGHT_SKIP_BROWSER_GC=1 is set. The IDE should not automatically delete user-installed browser binaries.

Actual Behavior

The Playwright cache directory is completely deleted when Windsurf IDE connects to WSL2, requiring reinstallation of browsers on every restart.

Impact

  • Time waste: Playwright browser installation takes 30-60 seconds each time
  • Bandwidth waste: Browser binaries are ~200-300MB each
  • Workflow disruption: MCP servers using Playwright fail until browsers are reinstalled
  • User frustration: Repeated manual intervention required

Workarounds

Temporary Workaround 1: Reinstall on Every Start

Add to project startup script:

playwright install chromium
# or
uv run install-browsers

Temporary Workaround 2: Use Project-Local Cache

Set PLAYWRIGHT_BROWSERS_PATH to project directory:

export PLAYWRIGHT_BROWSERS_PATH=./.playwright-cache

Temporary Workaround 3: Pre-Install Before IDE Start

Manually install browsers before starting Windsurf:

uv run install-browsers
# Then start Windsurf

Note: These workarounds are not ideal as they still require manual intervention or project-specific configuration.

Suggested Fix

  1. Respect Playwright's GC settings: Check for PLAYWRIGHT_SKIP_BROWSER_GC=1 before deleting cache
  2. Add configuration option: Provide a Windsurf setting to disable automatic cache cleanup
  3. Selective cleanup: Only delete cache if it's truly stale (e.g., based on age or version mismatch)
  4. User notification: Warn before deleting large cache directories

Additional Context

This behavior was discovered while investigating why Playwright browsers needed to be reinstalled on every Windsurf IDE restart in a WSL2 environment. The investigation involved:

  • File system monitoring with inotifywait
  • Process monitoring and snapshot capture
  • System call tracing with strace
  • Analysis of Windsurf Language Server logs

The deletion is performed by the Language Server process (server.go:288), indicating this is an intentional cleanup operation rather than a bug in Playwright itself.

Related Issues

  • Playwright's PLAYWRIGHT_SKIP_BROWSER_GC=1 environment variable is ignored
  • No user-facing setting to disable this behavior

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions