fix(install): retry Playwright install with platform override on unrecognized host (#35166) - #54032
Conversation
…cognized host (NousResearch#35166) On apt releases newer than the bundled Playwright recognizes (Ubuntu 26.04, Debian 14, and future distros), 'npx playwright install --with-deps chromium' hangs uninterruptibly at 'Installing Playwright Chromium with system dependencies' because Playwright's resolver maps the host to a platform with no download build (NousResearch#35166). Wrap every installer Playwright call in run_playwright_install(), which tries the native install first and, only if it fails or times out, retries once with PLAYWRIGHT_HOST_PLATFORM_OVERRIDE pinned to the newest known build (ubuntu24.04-<arch>). This is the escape hatch Playwright's maintainers bless for unrecognized platforms (microsoft/playwright#33434). Try-native-first (not a hardcoded distro/version table) is deliberate: - Self-correcting — when Playwright already supports the host (e.g. Ubuntu 26.04 on Playwright >=1.61) the first attempt succeeds and the override is never applied, so we never force a mismatched-glibc build onto a release Playwright handles correctly (microsoft/playwright#35114). - Zero-maintenance — new distro releases work the moment Playwright adds them. - Covers Debian 14+ and future releases, not just Ubuntu 26.04. An operator-set PLAYWRIGHT_HOST_PLATFORM_OVERRIDE is always respected (applied to the first attempt; retry skipped). Non-x64/arm64 arches have no fallback build and skip the retry. Refs NousResearch#35166
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved
Adds retry logic for Playwright install when the platform is unrecognized. On apt releases newer than Playwright knows (Ubuntu 26.04, Debian 14), playwright install hangs/fails. The new run_playwright_install wrapper tries native platform resolution first, then retries once with PLAYWRIGHT_HOST_PLATFORM_OVERRIDE pinned to the newest known build. Operator-pinned overrides are respected (retry skipped). Tests verify the wrapper structure, fallback targets, try-native-first logic, and operator override detection.
Reviewed by Hermes Agent
…p step interruptible Follow-up on #54032 for #35166: - Gate the PLAYWRIGHT_HOST_PLATFORM_OVERRIDE retry on the host being an apt release newer than Playwright recognizes (Ubuntu >24.04 / Debian >13) via playwright_host_unrecognized(), instead of retrying on ANY install failure. A network/disk/permission failure on a supported host now surfaces unchanged rather than getting a mismatched-glibc build forced onto it. - detect_os() now captures DISTRO_VERSION from os-release. - Fold in the interruptibility fix (was PR #35304, self-closed): wrap the download in 'timeout --foreground -k 10' (probed, with plain-timeout fallback) so a terminal Ctrl+C reaches the child and a wedged download is force-killed after the deadline. - Add behavioral tests that source the helpers and assert the retry fires only on Ubuntu 26.04 / Debian 14, not on supported hosts, non-apt distros, native-success, operator-pinned override, or unsupported arch.
|
Merged via #54078. Your commit was cherry-picked onto current main with your authorship preserved in git log. I scoped the override retry to fire only on apt releases newer than Playwright recognizes (Ubuntu >24.04 / Debian >13) instead of on any install failure, and folded in the interruptibility fix (timeout --foreground -k 10) so Ctrl+C reaches the download. Thanks for the root-cause analysis and the upstream references. |
…p step interruptible Follow-up on NousResearch#54032 for NousResearch#35166: - Gate the PLAYWRIGHT_HOST_PLATFORM_OVERRIDE retry on the host being an apt release newer than Playwright recognizes (Ubuntu >24.04 / Debian >13) via playwright_host_unrecognized(), instead of retrying on ANY install failure. A network/disk/permission failure on a supported host now surfaces unchanged rather than getting a mismatched-glibc build forced onto it. - detect_os() now captures DISTRO_VERSION from os-release. - Fold in the interruptibility fix (was PR NousResearch#35304, self-closed): wrap the download in 'timeout --foreground -k 10' (probed, with plain-timeout fallback) so a terminal Ctrl+C reaches the child and a wedged download is force-killed after the deadline. - Add behavioral tests that source the helpers and assert the retry fires only on Ubuntu 26.04 / Debian 14, not on supported hosts, non-apt distros, native-success, operator-pinned override, or unsupported arch.
…p step interruptible Follow-up on NousResearch#54032 for NousResearch#35166: - Gate the PLAYWRIGHT_HOST_PLATFORM_OVERRIDE retry on the host being an apt release newer than Playwright recognizes (Ubuntu >24.04 / Debian >13) via playwright_host_unrecognized(), instead of retrying on ANY install failure. A network/disk/permission failure on a supported host now surfaces unchanged rather than getting a mismatched-glibc build forced onto it. - detect_os() now captures DISTRO_VERSION from os-release. - Fold in the interruptibility fix (was PR NousResearch#35304, self-closed): wrap the download in 'timeout --foreground -k 10' (probed, with plain-timeout fallback) so a terminal Ctrl+C reaches the child and a wedged download is force-killed after the deadline. - Add behavioral tests that source the helpers and assert the retry fires only on Ubuntu 26.04 / Debian 14, not on supported hosts, non-apt distros, native-success, operator-pinned override, or unsupported arch.
…p step interruptible Follow-up on NousResearch#54032 for NousResearch#35166: - Gate the PLAYWRIGHT_HOST_PLATFORM_OVERRIDE retry on the host being an apt release newer than Playwright recognizes (Ubuntu >24.04 / Debian >13) via playwright_host_unrecognized(), instead of retrying on ANY install failure. A network/disk/permission failure on a supported host now surfaces unchanged rather than getting a mismatched-glibc build forced onto it. - detect_os() now captures DISTRO_VERSION from os-release. - Fold in the interruptibility fix (was PR NousResearch#35304, self-closed): wrap the download in 'timeout --foreground -k 10' (probed, with plain-timeout fallback) so a terminal Ctrl+C reaches the child and a wedged download is force-killed after the deadline. - Add behavioral tests that source the helpers and assert the retry fires only on Ubuntu 26.04 / Debian 14, not on supported hosts, non-apt distros, native-success, operator-pinned override, or unsupported arch.
…p step interruptible Follow-up on NousResearch#54032 for NousResearch#35166: - Gate the PLAYWRIGHT_HOST_PLATFORM_OVERRIDE retry on the host being an apt release newer than Playwright recognizes (Ubuntu >24.04 / Debian >13) via playwright_host_unrecognized(), instead of retrying on ANY install failure. A network/disk/permission failure on a supported host now surfaces unchanged rather than getting a mismatched-glibc build forced onto it. - detect_os() now captures DISTRO_VERSION from os-release. - Fold in the interruptibility fix (was PR NousResearch#35304, self-closed): wrap the download in 'timeout --foreground -k 10' (probed, with plain-timeout fallback) so a terminal Ctrl+C reaches the child and a wedged download is force-killed after the deadline. - Add behavioral tests that source the helpers and assert the retry fires only on Ubuntu 26.04 / Debian 14, not on supported hosts, non-apt distros, native-success, operator-pinned override, or unsupported arch.
…p step interruptible Follow-up on NousResearch#54032 for NousResearch#35166: - Gate the PLAYWRIGHT_HOST_PLATFORM_OVERRIDE retry on the host being an apt release newer than Playwright recognizes (Ubuntu >24.04 / Debian >13) via playwright_host_unrecognized(), instead of retrying on ANY install failure. A network/disk/permission failure on a supported host now surfaces unchanged rather than getting a mismatched-glibc build forced onto it. - detect_os() now captures DISTRO_VERSION from os-release. - Fold in the interruptibility fix (was PR NousResearch#35304, self-closed): wrap the download in 'timeout --foreground -k 10' (probed, with plain-timeout fallback) so a terminal Ctrl+C reaches the child and a wedged download is force-killed after the deadline. - Add behavioral tests that source the helpers and assert the retry fires only on Ubuntu 26.04 / Debian 14, not on supported hosts, non-apt distros, native-success, operator-pinned override, or unsupported arch.
…p step interruptible Follow-up on NousResearch#54032 for NousResearch#35166: - Gate the PLAYWRIGHT_HOST_PLATFORM_OVERRIDE retry on the host being an apt release newer than Playwright recognizes (Ubuntu >24.04 / Debian >13) via playwright_host_unrecognized(), instead of retrying on ANY install failure. A network/disk/permission failure on a supported host now surfaces unchanged rather than getting a mismatched-glibc build forced onto it. - detect_os() now captures DISTRO_VERSION from os-release. - Fold in the interruptibility fix (was PR NousResearch#35304, self-closed): wrap the download in 'timeout --foreground -k 10' (probed, with plain-timeout fallback) so a terminal Ctrl+C reaches the child and a wedged download is force-killed after the deadline. - Add behavioral tests that source the helpers and assert the retry fires only on Ubuntu 26.04 / Debian 14, not on supported hosts, non-apt distros, native-success, operator-pinned override, or unsupported arch.
…p step interruptible Follow-up on NousResearch#54032 for NousResearch#35166: - Gate the PLAYWRIGHT_HOST_PLATFORM_OVERRIDE retry on the host being an apt release newer than Playwright recognizes (Ubuntu >24.04 / Debian >13) via playwright_host_unrecognized(), instead of retrying on ANY install failure. A network/disk/permission failure on a supported host now surfaces unchanged rather than getting a mismatched-glibc build forced onto it. - detect_os() now captures DISTRO_VERSION from os-release. - Fold in the interruptibility fix (was PR NousResearch#35304, self-closed): wrap the download in 'timeout --foreground -k 10' (probed, with plain-timeout fallback) so a terminal Ctrl+C reaches the child and a wedged download is force-killed after the deadline. - Add behavioral tests that source the helpers and assert the retry fires only on Ubuntu 26.04 / Debian 14, not on supported hosts, non-apt distros, native-success, operator-pinned override, or unsupported arch.
What does this PR do?
Fixes the installer hanging uninterruptibly at
Installing Playwright Chromium with system dependencieson apt releases newer than the bundled Playwright recognizes — Ubuntu 26.04, Debian 14, and future distros (reported in #35166, confirmed across Ubuntu 24.04/26.04 and Debian 13).Root cause: Playwright maps the host OS to a CDN build in
hostPlatform.ts. When its resolver doesn't recognize the release, it returns a platform identifier with no download build (e.g.ubuntu26.04-x64on older Playwright), sonpx playwright install --with-deps chromiumstalls indefinitely — and Ctrl+C can't interrupt it.Fix: Wrap every installer Playwright call in
run_playwright_install(), which tries the native install first and — only if it fails or times out — retries once withPLAYWRIGHT_HOST_PLATFORM_OVERRIDEpinned to the newest known build (ubuntu24.04-<arch>). This is the escape hatch Playwright's maintainers bless for unrecognized platforms (microsoft/playwright#33434).Why try-native-first, not a version table
A hardcoded distro/version table is brittle and was explicitly rejected upstream (microsoft/playwright#33432 — "we'd rather... force install deps on an unsupported platform rather than adding new distros to the list"). The try-native-then-fallback approach is:
An operator-set
PLAYWRIGHT_HOST_PLATFORM_OVERRIDEis always respected (applied to the first attempt; retry skipped). Non-x64/arm64 arches have no Linux build and skip the retry.Type of Change
Changes Made
scripts/install.sh: addplaywright_fallback_platform()(arch → newest known build) andrun_playwright_install()(try-native-then-retry-with-override, composing the existingrun_browser_install_with_timeout). All 6npx playwright install ... chromiumcall sites now route through the new wrapper.tests/test_install_sh_browser_install.py: update the timeout-guard test to the new wrapper and add a regression test for the fallback contract (retries with the override, respects operator pinning, arch-aware target).How to Test
pytest tests/test_install_sh_browser_install.py -q— 7 passed.bash -n scripts/install.sh— syntax OK.npx/timeout/uname -m, and assert: native success → 1 attempt, no override; native fail → 2 attempts, retry carriesubuntu24.04-x64/-arm64; both fail → 2 attempts, non-zero rc; operator-pinned override → 1 attempt (no retry); unsupported arch → 1 attempt (no fallback).Related Issue
Refs #35166
Checklist
fix(install):)pytestpasses