Skip to content

Fix Playwright tunnel restart race - #5851

Open
JM (justinTM) wants to merge 3 commits into
microsoft:mainfrom
justinTM:justinTM/playwright-tunnel-lifecycle-race
Open

JM (justinTM) wants to merge 3 commits into
microsoft:mainfrom
justinTM:justinTM/playwright-tunnel-lifecycle-race

Conversation

@justinTM

@justinTM JM (justinTM) commented Jun 29, 2026 •

Copy link
Copy Markdown

Summary

Fixes #5852.

Fixes a lifecycle race in the Playwright Local Browser Server VS Code extension where a rapid stop/start could create a replacement tunnel before the previous tunnel finished stopping.

The extension now tracks an in-progress stop promise, waits for it before starting a replacement tunnel, and only clears the active tunnel reference after stopAsync() settles.

Commit structure

This PR is intentionally split into a red/green sequence:

  1. 39a590c935 - adds the real VS Code host regression test only.
  2. d16c95ebb1 - adds the lifecycle fix and change file.

Red/green proof

Both runs used the same command sequence from vscode-extensions/playwright-local-browser-server-vscode-extension:

  • PATH=/Users/justin/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH /Users/justin/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin/node ../../common/scripts/install-run-rushx.js build
  • env -u GITHUB_ACCESS_TOKEN -u GH_TOKEN -u GITHUB_TOKEN -u GITLAB_ACCESS_TOKEN -u RUNNER_REGISTRATION_TOKEN -u TAILSCALE_AUTH_KEY PATH=/Users/justin/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin:$PATH VSCODE_EXECUTABLE_PATH='/Applications/Visual Studio Code.app/Contents/MacOS/Electron' /Users/justin/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/bin/node ../../common/scripts/install-run-rushx.js test:vscode

Red, at test-only commit 39a590c935:

AssertionError [ERR_ASSERTION]: Start resolved while the previous Stop command was still pending.
true !== false
Exit code:   1
RED_EXIT=1

Green, after fix commit d16c95ebb1:

Playwright tunnel restart remained pending behind the in-progress stop.
Exit code:   0
GREEN_EXIT=0

I also ran git diff --check origin/main...HEAD on the final branch.

Notes

The test:vscode script launches a real VS Code extension host against the built dist/vsix/unpacked extension using @vscode/test-electron. It runs a focused rapid Start/Stop/Start assertion that verifies restart remains pending while the prior Stop command is still in progress.

@github-project-automation github-project-automation Bot moved this to Needs triage in Bug Triage Jun 29, 2026
@justinTM
JM (justinTM) force-pushed the justinTM/playwright-tunnel-lifecycle-race branch 2 times, most recently from 72c25f0 to b684d04 Compare June 30, 2026 00:36

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

Playwright Local Browser Server Start can race with in-progress Stop

1 participant