Skip to content

[Bug]: MCP test_run tool doesn't stop test execution when aborted #38937

@mxschmitt

Description

@mxschmitt

Version

1.58.0-alpha-2026-01-22

Steps to reproduce

  1. Start the Playwright test MCP server (npx playwright run-test-mcp-server)
  2. Connect an MCP client (e.g., Claude Code) and call the test_run tool on a slow-running test
  3. While tests are running, abort/cancel the MCP call (e.g., press Escape in Claude Code or in another MCP client)
  4. Expected: Test execution stops immediately
  5. Actual: Test execution continues running in the background despite the MCP call being aborted

Error shown in client:
Error: MCP error -32001: AbortError: The operation was aborted.

But the underlying test process keeps running until completion.

Expected behavior

When an MCP tool call (like test_run) is aborted by the client, the underlying test execution should stop immediately. The MCP SDK provides an AbortSignal that should be used to cleanly terminate long-running operations.

Actual behavior

The abort signal from the MCP SDK is not propagated to the test runner When a test_run call is aborted, the MCP call returns an error to the client, but the test execution continues running in the background until it completes naturally or times out.

Additional context

I can also reproduce it on @next.

Environment

System:
    OS: macOS 26.2
    CPU: (12) arm64 Apple M4 Pro
    Memory: 132.92 MB / 24.00 GB
  Binaries:
    Node: 24.9.0 - /Users/max/.nvm/versions/node/v24.9.0/bin/node
    Yarn: 1.22.22 - /Users/max/.nvm/versions/node/v24.9.0/bin/yarn
    npm: 11.6.2 - /Users/max/.nvm/versions/node/v24.9.0/bin/npm
    pnpm: 10.18.3 - /Users/max/.nvm/versions/node/v24.9.0/bin/pnpm
  IDEs:
    VSCode: 2.3.41 - /usr/local/bin/code
    Cursor: 2.3.41 - /usr/local/bin/cursor
    Claude Code: 2.1.17 - /Users/max/.local/bin/claude
    Codex: 0.63.0 - /Users/max/.nvm/versions/node/v24.9.0/bin/codex
    opencode: 1.0.68 - /Users/max/.opencode/bin/opencode
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    @playwright/test: ^1.58.0-alpha-2026-01-22 => 1.58.0-alpha-2026-01-22

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions