Skip to content

fix(browser): start Chromium from relative and hermetic Playwright caches - #164659

Merged
obviyus merged 1 commit into
openclaw:mainfrom
ly85206559:codex/fix-browser-cache-contract-20261003
Oct 7, 2026
Merged

obviyus merged 1 commit into
openclaw:mainfrom
ly85206559:codex/fix-browser-cache-contract-20261003

Conversation

@ly85206559

@ly85206559 ly85206559 commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: Linux browser startup cannot find Chromium installed using relative Playwright cache paths, npm configuration aliases, or a hermetic PLAYWRIGHT_BROWSERS_PATH=0 install.

User Impact

Existing Playwright installations can be discovered without setting an explicit browser executable path. System/custom executable precedence and default-cache fallback are preserved. No new dependency, configuration option, or migration is introduced.

Why This Change Was Made

Related: #163510. Extend the existing Linux cache locator to match the installed Playwright 1.63.0 locator contract: undefined-only environment aliases, the installer invocation directory for relative paths, exact path bytes, and package-local hermetic caches. Resolve package metadata only for the hermetic case, without importing the browser runtime.

Evidence

  • Untouched production baseline: da9cb6dfaa748c125e49f736e51300d0ea57caab. Focused RED: 22 passed and 11 intended cache-locator assertions failed; zero suite, hook, or unhandled errors. The existing matrix now includes aliases, precedence, empty values, relative paths, path whitespace, and hermetic installs.
  • Actual CLI/Chromium RED: the real Playwright 1.63.0 installer provides Chromium. The absolute-cache control launches through pnpm openclaw, verifies the executable/PID and CDP document readback, and stops cleanly. Relative INIT_CWD, npm_config_playwright_browsers_path, and hermetic 0 cases each fail only with the expected unsupported-browser discovery error. Task-owned Gateway identity and cleanup checks pass for all four cases.
  • Prior-head GREEN on aab42d5998a47ff02dfddba4919408d0c5449bd1: 33/33 matrix tests pass (cold wall/test time 4.62s/0.237s). All four real installer/CLI cases launch the expected executable, verify its PID and CDP document readback, and stop cleanly. Formatting, git diff --check, and canonical check-changed gates pass, including extension/test types, lint, and ownership guards. This individual job succeeded; the aggregate run contains an older NFC formatting failure superseded by that candidate's separate final-head run.
  • Conflict repair on current main ea00cb30c6611dafb186a959cb90ff5bf83d2b5f: maintainer #165177 deleted four redundant browser-cache matrix cases and a redundant macOS fallback case. Rebasing kept those deletions while retaining this PR's new Playwright locator regressions. Current head f78ffaac109cfccedfdd41a5d5776d351ed35703 has byte-identical production and docs blobs to the prior tested head; only the test table lost redundant baseline cases. The first rebase head ed27ca686d1b7b95754317be499616e83d2e81ba failed upstream formatting checks because its conflict resolution shifted test indentation; that indentation is restored in the current head. git diff --check passes, and the complete three-file current-head P0–P3 autoreview is scoped-clean with no findings (confidence 0.90). The local Windows Node is 24.13.1 and lacks Playwright dependencies, so no local test result is claimed; current-head upstream CI is the remaining check.
  • Proof runs only in secretless fork Actions with synthetic isolated state. Real-flow proof targets Linux x64; ARM64 cache-layout assertions are unit coverage, not a physical ARM64 claim. macOS and Windows discovery behavior is unchanged.

Maintainer verification

No overlap with Pash/Sarah changes.

Preserved ly85206559's implementation and commits; no additional source changes were needed. Current-main changes to this module affect a disjoint desktop-browser detection hunk, and the merge-tree is clean.

  • Linux ARM64 / Node 24.21.0 / Playwright 1.63.0: current main f462f36d6afd62018af80ad24245fd20ed4af256 fails the relative-install-root, npm-config-alias and hermetic-zero scenarios with the expected unsupported-browser discovery error. Exact candidate f78ffaac109cfccedfdd41a5d5776d351ed35703 starts actual Chromium in all three scenarios through pnpm openclaw, returns the expected tab from browser tabs, verifies the executable/PID and CDP document, and stops cleanly. Both relative and hermetic Chromium were installed with Playwright itself.
  • Absolute-cache, default-cache, system-Chromium precedence and explicit-executable precedence controls pass on base and candidate. System precedence uses a temporary /usr/bin/chromium symlink to the installed real Chromium in the isolated container. The first candidate control readback encountered a harness-only page-context startup race; the remaining controls were exercised after making the CDP readiness wait tolerate that transient state.
  • Candidate regression file: 28/28 pass, 2.96s wrapper wall time (2.10s Vitest). Same tests on current main: 11 intended failures, 17 pass. Hosted changed-node CI took 1m48s; no additional CI run was requested.
  • Real pnpm tsgo:extensions passes. Both source snapshots built successfully; all execution was inside isolated Docker with Gateway state on tmpfs.
  • Exact-head real-provider gate: one openai/gpt-5-mini agent turn, low reasoning, 4096-token output budget, successful expected response. Temporary credential removed.
  • Exact-head CI gate is green and ClawSweeper is ready. The single cancelled PR context and evidence check was superseded by the successful same-head check; no selected test job was cancelled.

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: browser size: S labels Oct 4, 2026
@ly85206559
ly85206559 marked this pull request as ready for review October 4, 2026 01:19
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 4, 2026, 10:05 PM ET / October 5, 2026, 02:05 UTC (Revision 3).

ClawSweeper review

What this changes

The browser plugin discovers Linux Chromium in relative, npm-configured, and package-local Playwright caches, with regression coverage and documentation.

Merge readiness

✅ Ready for maintainer review

This PR remains necessary: current main lacks the requested cache discovery behavior, and the related merged fix covers only XDG caches. The scoped review found no actionable correctness or security defects, and the existing real-browser proof applies to the unchanged production source.

Priority: P2
Reviewed head: f78ffaac109cfccedfdd41a5d5776d351ed35703

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused dependency-compatible repair with strong applicable real-browser proof and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The successful pinned Linux x64 browser job exercises the changed executable-selection owner through the real CLI/Gateway, actual Chromium, PID verification, CDP document readback, and shutdown across four cache scenarios. Production blobs match this head; raw logs were inaccessible to the reviewer, but the captured results, inspected harness, and job metadata support the proof. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The successful pinned Linux x64 browser job exercises the changed executable-selection owner through the real CLI/Gateway, actual Chromium, PID verification, CDP document readback, and shutdown across four cache scenarios. Production blobs match this head; raw logs were inaccessible to the reviewer, but the captured results, inspected harness, and job metadata support the proof. No stored-data contract changes.
Evidence reviewed 9 items Pinned introduced change: The merge-base-to-head patch adds undefined-only environment aliases, relative-path resolution, and package-local hermetic discovery to the existing Linux executable-selection owner. Custom and system-browser precedence and default-cache fallback remain intact.
Current main still needs the repair: Current main reads only PLAYWRIGHT_BROWSERS_PATH directly, excludes its zero value, trims configured paths, and does not resolve relative caches against INIT_CWD. The requested behavior is therefore still missing.
Applicable dependency contract: The PR explicitly targets Playwright 1.63.0 locator compatibility, and the browser plugin declares that dependency. npm metadata verifies microsoft/playwright ownership and gitHead. The published package's lib/coreBundle.js implements undefined-only aliases at lines 8152–8156 and hermetic/relative registry resolution at lines 33118–33130; the patch matches those semantics while retaining OpenClaw's existing fallback.
Findings None None.
Security None None.

How this fits together

The browser plugin selects a local Chromium executable from configuration, installed system browsers, and Playwright caches. Its launcher starts that executable in an isolated OpenClaw profile and exposes browser control through the Gateway.

flowchart TD
  A[Browser configuration] --> C[Executable selection]
  B[System browsers and cache settings] --> C
  C --> D[Resolve Playwright cache locations]
  D --> E[Find executable Chromium]
  E --> F[Launch isolated browser profile]
  F --> G[Gateway browser control]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +20, Tests +145, Docs +4. Total +169 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 27 7 +20
Tests 1 162 17 +145
Docs 1 5 1 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 194 25 +169

Review metrics

None.

Technical review

Best possible solution:

Keep Linux executable discovery aligned with the installed Playwright locator contract while preserving configured executables, system-browser precedence, and default-cache fallback.

Do we have a high-confidence way to reproduce the issue?

Yes: current source misses npm aliases and hermetic caches and resolves relative caches differently from Playwright. The contributor also supplies baseline failing CLI scenarios; this review did not execute a current-main reproduction.

Is this the best way to solve the issue?

Yes: extending the existing executable-selection owner is a focused repair, and the independently inspected dependency contract supports the chosen semantics.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b02eab15853b.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This repairs browser startup for specific Linux Playwright installation layouts with a bounded discovery change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The successful pinned Linux x64 browser job exercises the changed executable-selection owner through the real CLI/Gateway, actual Chromium, PID verification, CDP document readback, and shutdown across four cache scenarios. Production blobs match this head; raw logs were inaccessible to the reviewer, but the captured results, inspected harness, and job metadata support the proof. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The successful pinned Linux x64 browser job exercises the changed executable-selection owner through the real CLI/Gateway, actual Chromium, PID verification, CDP document readback, and shutdown across four cache scenarios. Production blobs match this head; raw logs were inaccessible to the reviewer, but the captured results, inspected harness, and job metadata support the proof. No stored-data contract changes.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head patch adds undefined-only environment aliases, relative-path resolution, and package-local hermetic discovery to the existing Linux executable-selection owner. Custom and system-browser precedence and default-cache fallback remain intact. (extensions/browser/src/browser/chrome.executables.ts:489, f78ffaac109c)
  • Current main still needs the repair: Current main reads only PLAYWRIGHT_BROWSERS_PATH directly, excludes its zero value, trims configured paths, and does not resolve relative caches against INIT_CWD. The requested behavior is therefore still missing. (extensions/browser/src/browser/chrome.executables.ts:488, b02eab15853b)
  • Applicable dependency contract: The PR explicitly targets Playwright 1.63.0 locator compatibility, and the browser plugin declares that dependency. npm metadata verifies microsoft/playwright ownership and gitHead. The published package's lib/coreBundle.js implements undefined-only aliases at lines 8152–8156 and hermetic/relative registry resolution at lines 33118–33130; the patch matches those semantics while retaining OpenClaw's existing fallback. (1b025d7e20a0)
  • Real production-path proof: The captured PR body reports successful Linux x64 absolute-control, relative INIT_CWD, npm-alias, and hermetic-zero scenarios. GitHub confirms browser job 111328675105 succeeded. Its pinned workflow checks out candidate aab42d5998a47ff02dfddba4919408d0c5449bd1 and invokes the inspected proof script through pnpm openclaw and a real Gateway, verifying Chromium executable/PID, CDP document contents, browser stop, and process cleanup. The workflow's unrelated aggregate failure does not negate this successful browser job. Raw log download was blocked by the review network allowlist; no script was executed by this review. (.github/workflows/proof-browser-cache-green.yml:21, abec793e00bb)
  • Proof assertions exercise the changed owner: The complete browser-cache-browser-runtime.mjs artifact installs actual Playwright Chromium, invokes browser start through the CLI/Gateway, asserts the selected executable and /proc PID identity, reads a synthetic document through CDP, and checks shutdown. Its four scenarios directly exercise the cache-selection behavior changed by this PR. (.proof/browser-cache-browser-runtime.mjs, 2e27f76864c6)
  • Proof remains applicable after rebase: GitHub's prior-candidate contents and local current-head object IDs independently match: production blob eef6623b5aba0f5a80975b3be6069d65948649a3 and documentation blob 939f0acc08055b6c9e865a94f52ea93a2c4e8385. Prior-head runtime proof remains applicable; current-head CI is separate evidence. The previous review retained no findings or published rank-up moves. (extensions/browser/src/browser/chrome.executables.ts:498, f78ffaac109c)

Likely related people:

  • ly85206559: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • jesse-merhi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-04T01:24:32.561Z sha aab42d5998a47ff02dfddba4919408d0c5449bd1 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-05T01:54:49.350Z sha ed27ca686d1b7b95754317be499616e83d2e81ba :: needs maintainer review before merge. :: none

@ly85206559
ly85206559 force-pushed the codex/fix-browser-cache-contract-20261003 branch from aab42d5 to ed27ca6 Compare October 5, 2026 01:46
@ly85206559
ly85206559 force-pushed the codex/fix-browser-cache-contract-20261003 branch from ed27ca6 to f78ffaa Compare October 5, 2026 01:58
@obviyus
obviyus merged commit 8fffeca into openclaw:main Oct 7, 2026
122 of 123 checks passed
@obviyus

obviyus commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Landed. Thanks @ly85206559! Verified on Linux arm64 with real Playwright installs: current main could not find Chromium from a relative, npm-alias or hermetic cache; with this the browser starts and openclaw browser tabs works, while explicit-path, system-browser and default-cache precedence are unchanged.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 7, 2026
…ches (openclaw#164659)

Discover Linux Chromium installed through relative PLAYWRIGHT_BROWSERS_PATH values, npm configuration aliases, and hermetic PLAYWRIGHT_BROWSERS_PATH=0 installs, keeping explicit executable and system browser precedence and the default cache fallback.

Co-authored-by: Ayaan Zaidi <[email protected]>
@ly85206559
ly85206559 deleted the codex/fix-browser-cache-contract-20261003 branch October 7, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: browser P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants