Skip to content

Update/skill check misdetects the command when the session is passed as -s <name> or --session <name> #505

Closed

Description

checkForUpdates() in playwright-cli.js takes the first argument not starting with - as the command:

const command = process.argv.slice(2).find(arg => !arg.startsWith('-'));

With the space-separated forms the core parser accepts (-s foo, --session foo), that is the session name, not the command.

Steps to reproduce

Using an empty PLAYWRIGHT_CLI_INSTALLATION_FOR_TEST dir and checking whether cli-update-check.json gets written:

invocation check ran
list yes
-s=foo list yes
-s foo list no
--session foo open <url> no
-s list snapshot yes (spawns npm view on a non-workflow command)

Expected

The check runs for open/attach/list/install/install-browser regardless of how the session is passed, and never for other commands.

Suggested fix

Skip the value of -s/--session (and other string globals) when scanning, or parse with the same minimist options program() uses and read args._[0].

Environment

  • @playwright/cli 0.1.23 (main @ f50f579), playwright-core 1.65.0-alpha-2026-10-30
  • Node 22.23.4, Linux x64, Chrome for Testing 153

Activity

  1. github-actions commented on Nov 5, 2026

    @github-actions
  2. microsoft-playwright-automation commented on Nov 5, 2026

    @microsoft-playwright-automation
    Contributor

    Hi, I'm the Playwright bot and I reproduced this on Linux.

    Reproduced on @playwright/cli 0.1.23, main 2cbc57d186eb8a70e64ebbd6c923741100c69a9e, with playwright-core 1.65.0-alpha-2026-10-30. The update check mistakes a space-separated session value for the command. The proposed fix uses the core CLI's parser and matching options, so update and skill checks follow the actual command, including the skill-warning exemption for install.

    Reproduction and verification

    The existing integration tests use an isolated installation directory and a fake npm registry, with CI and NO_UPDATE_NOTIFIER cleared:

    • -s foo list omitted the stale-skill warning before the fix; it warns after the fix.
    • -s list snapshot incorrectly requested the latest version before the fix; after the fix it makes no registry request and writes no update-check cache.
    • --session list install --skills incorrectly warned about the skill being installed before the fix; after the fix it checks for updates without that skill warning.
    • --session foo list requests the latest version after the fix.
    • --version remains silent and makes no registry request.

    All three extended regression tests failed on unchanged main. After the fix, npm test passes all nine integration tests, including default headless Chrome navigation, update caching, scoped registries, and registry failure/timeout handling. This is argument parsing before browser dispatch, not an engine-specific issue. No build or lint command exists in this repository.

    Draft PR: #521

    Triaged on Linux by the Playwright bot - agent run

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions