Skip to content

fix(install): retry Playwright install with platform override on unrecognized host (#35166) - #54032

Closed
kshitijk4poor wants to merge 1 commit into
NousResearch:mainfrom
kshitijk4poor:fix/installer-playwright-unsupported-platform-fallback
Closed

fix(install): retry Playwright install with platform override on unrecognized host (#35166)#54032
kshitijk4poor wants to merge 1 commit into
NousResearch:mainfrom
kshitijk4poor:fix/installer-playwright-unsupported-platform-fallback

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

What does this PR do?

Fixes the installer hanging uninterruptibly at Installing Playwright Chromium with system dependencies on 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-x64 on older Playwright), so npx playwright install --with-deps chromium stalls 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 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).

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:

  • 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 ([Bug]: version `GLIBC_2.36' not found... microsoft/playwright#35114).
  • Zero-maintenance — new distro releases work the moment Playwright adds them, with no change here.
  • Broad — 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 Linux build and skip the retry.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • scripts/install.sh: add playwright_fallback_platform() (arch → newest known build) and run_playwright_install() (try-native-then-retry-with-override, composing the existing run_browser_install_with_timeout). All 6 npx playwright install ... chromium call 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

  1. pytest tests/test_install_sh_browser_install.py -q — 7 passed.
  2. bash -n scripts/install.sh — syntax OK.
  3. Behavioral: extract the three functions, stub npx/timeout/uname -m, and assert: native success → 1 attempt, no override; native fail → 2 attempts, retry carries ubuntu24.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

  • Read the Contributing Guide
  • Conventional Commit message (fix(install):)
  • Searched existing PRs (the prior interruptibility PR fix(install): make Playwright browser install interruptible #35304 was closed unmerged and never fixed the root cause)
  • Only changes related to this fix
  • pytest passes
  • Added a regression test
  • Considered cross-platform impact (Linux apt/arch/rpm/zypper branches; no-ops on unsupported arch and when operator-pinned)

…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
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard tool/browser Browser automation (CDP, Playwright) P2 Medium — degraded but workaround exists labels Jun 28, 2026

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

teknium1 added a commit that referenced this pull request Jun 28, 2026
…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.
@teknium1

Copy link
Copy Markdown
Contributor

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.

@teknium1 teknium1 closed this Jun 28, 2026
pai-scaffolde pushed a commit to pai-scaffolde/hermes-agent that referenced this pull request Jun 28, 2026
…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.
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
…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.
Jasper6439 pushed a commit to Jasper6439/hermes-agent that referenced this pull request Jul 5, 2026
…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.
habarmc1223-sudo pushed a commit to habarmc1223-sudo/hermes-agent-fluxmem that referenced this pull request Jul 8, 2026
…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.
santhreal pushed a commit to santhreal/hermes-agent that referenced this pull request Jul 13, 2026
…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.
Gravezzz pushed a commit to Gravezzz/hermes-agent that referenced this pull request Jul 21, 2026
…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.
@kshitijk4poor
kshitijk4poor deleted the fix/installer-playwright-unsupported-platform-fallback branch August 5, 2026 07:09
leewenjie pushed a commit to leewenjie/hermes-agent that referenced this pull request Aug 7, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists tool/browser Browser automation (CDP, Playwright) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants