Skip to content

feat(browser): support lightweight Docker browser installs - #154608

Merged
vincentkoc merged 11 commits into
mainfrom
feat/browser-08-docker-efficiency
Oct 24, 2026
Merged

vincentkoc merged 11 commits into
mainfrom
feat/browser-08-docker-efficiency

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Related: #154341
Builds on #154607.

What Problem This Solves

Docker operators cannot select a single Chromium distribution without losing Diffs PNG/PDF rendering, and the optional Lightpanda sidecar needs connection readiness and predictable shutdown.

User Impact

Operators can install full Chromium or headless shell explicitly; OPENCLAW_INSTALL_BROWSER=1 keeps both. Headless sandbox startup skips Xvfb. Lightpanda uses a WebSocket healthcheck and graceful SIGTERM, with CPU, memory, and PID limits left to operator configuration.

Why This Change Was Made

Browser selection stays with Playwright and the shared renderer discovery owner. The change preserves current Node, Playwright, and Lightpanda 1.0.2 image pins; documents the selected image's license boundary; and removes unconditional sidecar resource ceilings and their extra sample knobs. Existing unrestricted sidecar capacity is preserved; no stored-data shape changes.

Evidence

  • 83 focused tests passed: Docker installer (70) and Diffs renderer (13), including full-only and shell-only discovery.
  • Exact pinned Lightpanda 1.0.2 image on Linux arm64: the native browser adapter completed navigation, snapshot, type, exactly-once submit, wait, text extraction, capability, single-page, and stale-target checks.
  • The configured healthcheck preserved an existing page and subsequent action. A deliberate owned child crash restarted healthy. SIGTERM exited 0 in 145 ms without SIGKILL or OOM.
  • Docker packaging and UI build passed on Linux arm64. One common build graph served all three browser selectors; full-only and shell-only packaged Diffs each rendered PNG and PDF through one shared browser process.
  • The real sandbox entrypoint with HEADLESS=1 and noVNC disabled reached CDP without Xvfb and exited through its native TERM cleanup.
  • Legacy 1 contains both Chromium distributions and FFmpeg; an ordinary Playwright launch used headless shell, performed a real page action, and closed cleanly.

Known follow-up: sandbox headed Xvfb readiness barrier. The unchanged headed path starts Xvfb asynchronously and immediately launches Chromium. The direct Chrome-for-Testing fixture reached Chromium before display readiness and failed; this is not a headed-runtime pass. No sleeps, timeout changes, or startup fallback were added.

The controller ran on macOS arm64; container results are Linux arm64, not x86 coverage. Historical performance numbers are not current-image proof, and this PR makes no new RSS or speed claim.

Review note: the Dockerfile string assertions are structural coverage, not proof of selector behavior; the three built images and real rendering/launch checks provide that proof. A separate base-red/head-green replay was not recorded. The existing focused assertions are retained in this scoped change.

@clawsweeper

clawsweeper Bot commented Sep 21, 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 scripts Repository scripts docker Docker and sandbox tooling extensions: diffs extensions: browser size: S maintainer Maintainer-authored PR labels Sep 21, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 21, 2026
@clawsweeper

clawsweeper Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds selective Docker Chromium installs, supports them in Diffs rendering, skips Xvfb for headless sandboxes, and improves Lightpanda readiness and shutdown.

Example: An operator builds with OPENCLAW_INSTALL_BROWSER=chromium and requests a Diffs PDF.

  • Before: The build installs both Chromium distributions; a full-only installation lacks renderer discovery support.
  • After: The build installs full Chromium only, and Diffs discovers its Playwright-managed executable to render the PDF.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful and focused, with reported production-path coverage and no blocking finding; runtime results are recorded as maintainer observations, and the source-string test additions provide little independent protection.
Proof confidence 🐚 platinum hermit (4/6) The ordinary contributor-proof gate does not apply to this maintainer-authored PR; its body records Linux arm64 packaged rendering, legacy Playwright launch compatibility, real headless entrypoint cleanup, and exact-image Lightpanda readiness, page preservation, crash recovery, and SIGTERM results, without claiming x86 or headed-runtime coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Docker operators need smaller browser installations that retain Diffs rendering and an optional Lightpanda service with observable readiness and graceful shutdown.
Reason: The maintainer-authored direction adds practical deployment choices while retaining the documented legacy installation mode and existing sidecar capacity.

Merge readiness

✅ Ready for maintainer review

The previous resource-limit blocker is fixed, and no introduced production defect was found. This maintainer-approved packaging improvement remains useful; exact-head CI is still pending.

Priority: P2
Reviewed head: e3f8c57fe1a2b250c7d7021073d65b92a5892f09

Before merge

None.

Findings

None.

Tests

  • Low-value test test/scripts/test-install-sh-docker.test.ts: The added Dockerfile string assertions mirror shell implementation text and can pass while selector behavior is broken; remove these additions in favor of the recorded image-build and runtime coverage.
  • Missing end-to-end proof: Base-red/head-green execution of the new discovery regression cases is not recorded.
Agent review details

How this fits together

Docker build arguments select installed browser binaries; the Diffs renderer discovers and launches Chromium, while the sandbox entrypoint and optional Lightpanda Compose service manage their respective browser processes.

flowchart TD
  A[Docker build selector] --> B[Playwright installer]
  B --> C[Installed Chromium binaries]
  C --> D[Diffs browser discovery]
  D --> E[PNG and PDF artifacts]
  F[Sandbox entrypoint] --> C
  G[Lightpanda Compose service] --> H[Browser plugin CDP adapter]
Loading

Technical review

Best possible solution:

Retain the existing installer, renderer discovery, and process owners with selectable distributions and operator-controlled sidecar capacity.

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

Source confirms that main installs both distributions for a nonempty build argument and that Diffs lacks the managed full-browser candidate; no target code was executed during this review.

Is this the best way to solve the issue?

The change uses Playwright's supported selectors and extends existing discovery and lifecycle owners without adding a competing manager or persisted state.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Optional Docker browser installation keeps the original intent (d6aa9ad: Preinstall Chromium optionally to avoid repeated runtime installation; later changes preserve browser-cache discovery and non-root cache ownership.)
  • Shared Diffs browser selection keeps the original intent (556a26f: Consolidate discovery under the shared browser promise and apply selection changes after idle close; earlier renderer history establishes explicit and system executable precedence.)
  • Sandbox display and cleanup lifecycle keeps the original intent (c61be87: Fail fast on Chromium startup failure and clean up tracked processes; the patch preserves headed startup and cleanup while omitting an unused display in headless mode.)
  • Lightpanda deployment and licensing changes intended behavior with a stated reason (docs(browser): audit engine licenses and non-AGPL alternatives #154382: Keep the external AGPL engine opt-in and document its distribution boundary; the patch explains a source-verified disagreement between upstream license declarations.)
  • Portable browser benchmark keeps the original intent (645f1bc: Exercise deterministic navigation, reference-based form submission, extraction, and session boundaries through the browser routes.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned change and clean checkout: Inspected the complete introduced diff against the verified merge base, applicable root and ancestor instructions, and the simplification guidance; the checkout remains clean. No maintainer-notes directory exists at this revision. (AGENTS.md:1, e3f8c57fe1a2)
  • Previous blocker resolved: Comparison with the previously reviewed head confirms removal of mem_limit, cpus, pids_limit, and the associated sample knobs; the current sample preserves unrestricted capacity. (deploy/lightpanda/compose.yaml:35, e3f8c57fe1a2)
  • Existing owners retained: The installer preserves legacy 1 and delegates distribution selection to Playwright; Diffs adds its managed full-browser candidate after explicit and system choices, inside the existing shared-browser lifecycle. (extensions/diffs/src/browser.runtime.ts:324, e3f8c57fe1a2)
  • Current main still lacks this integration: Fetched main retains the nonempty browser-install switch and lacks the Playwright executable candidate in Diffs; the central packaging change remains distinct from the merged prerequisite improve(browser): default managed Chromium to efficient headless launches #154607. (Dockerfile:368, bfdc5f96a7c9)
  • Runtime report and accepted direction: The full maintainer-authored body reports Linux arm64 image builds, full-only and shell-only packaged PNG/PDF rendering, legacy default Playwright compatibility, headless sandbox CDP startup and cleanup, and exact-image Lightpanda probe isolation, crash recovery, and graceful termination; x86 coverage is explicitly unclaimed. (e3f8c57fe1a2)
  • Headed limitation predates the patch: The base already starts Xvfb asynchronously before Chromium; the introduced condition leaves that headed path unchanged, matching the maintainer's disclosed follow-up. (scripts/sandbox-browser-entrypoint.sh:93, 9cf739b6c0da)

Likely related people:

  • Vincent Koc: Raw commit 645f1bc adds deploy/lightpanda/compose.yaml:9 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 645f1bc4ef49; files: deploy/lightpanda/compose.yaml)
  • Peter Steinberger: Raw commit 4ba4f3b adds extensions/diffs/src/browser.runtime.ts:319 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4ba4f3b2cda2; files: extensions/diffs/src/browser.runtime.ts)
  • Gustavo Madeira Santana: Raw commit 612ed5b adds extensions/diffs/src/browser.ts:128 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 612ed5b3e1ea; files: extensions/diffs/src/browser.ts)

PR surface

Source +9, Tests +37, Docs +64, Other +31. Total +141 across 11 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 9 0 +9
Tests 2 39 2 +37
Docs 4 76 12 +64
Config 0 0 0 0
Generated 0 0 0 0
Other 3 46 15 +31
Total 11 170 29 +141

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove proof: sufficient: Current real behavior proof status is not_applicable, not sufficient.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.
  • remove merge-risk: 🚨 availability: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Useful opt-in Docker packaging and browser lifecycle improvements with limited blast radius and preserved legacy installation behavior.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (19 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-23T18:21:18.702Z sha e6d320e :: blocked before merge. :: [P1] Preserve existing Lightpanda capacity by default
  • reviewed 2026-09-23T18:51:58.720Z sha d816183 :: blocked before merge. :: [P1] Keep Lightpanda resource limits opt-in
  • reviewed 2026-09-23T19:50:06.918Z sha d816183 :: blocked before merge. :: [P1] Keep Lightpanda resource limits opt-in
  • reviewed 2026-09-23T20:15:09.034Z sha d816183 :: blocked before merge. :: [P1] Keep Lightpanda resource limits opt-in
  • reviewed 2026-09-23T21:21:37.832Z sha d689f78 :: blocked before merge. :: [P1] Keep Lightpanda resource limits opt-in
  • reviewed 2026-10-06T23:52:22.506Z sha d689f78 :: blocked before merge. :: [P1] Keep Lightpanda resource limits opt-in
  • reviewed 2026-10-06T23:59:45.201Z sha d689f78 :: blocked before merge. :: [P1] Keep Lightpanda resource limits opt-in
  • reviewed 2026-10-07T00:08:01.754Z sha d689f78 :: blocked before merge. :: [P1] Keep Lightpanda resource limits opt-in

Reviewed October 24, 2026, 3:13 AM ET / 07:13 UTC (Revision 20).

@vincentkoc
vincentkoc force-pushed the feat/browser-07-chromium-efficiency branch from c18bc0a to 89730fc Compare September 21, 2026 10:08
@vincentkoc
vincentkoc marked this pull request as ready for review September 21, 2026 10:09
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 21, 2026
@vincentkoc
vincentkoc force-pushed the feat/browser-08-docker-efficiency branch from 07cce57 to b9085a3 Compare September 21, 2026 10:54
@vincentkoc
vincentkoc force-pushed the feat/browser-07-chromium-efficiency branch from 89730fc to 4428666 Compare September 21, 2026 10:54
@vincentkoc
vincentkoc force-pushed the feat/browser-08-docker-efficiency branch from b9085a3 to c6198e5 Compare September 21, 2026 11:02
@vincentkoc
vincentkoc force-pushed the feat/browser-07-chromium-efficiency branch from 4428666 to c0baa35 Compare September 21, 2026 11:02
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 21, 2026
Base automatically changed from feat/browser-07-chromium-efficiency to main October 15, 2026 07:28
Baseline-Refresh: 6e1a17a347f7a57b21f36f75a85fb46ca702f5d7
Preserve the current shared browser discovery helper and renderer fixtures after baseline integration. Leave Lightpanda resource ceilings with operators and keep selected-image proof wording version neutral.
@vincentkoc vincentkoc changed the title improve(browser): trim Docker browser images and harden Lightpanda sidecar feat(browser): support lightweight Docker browser installs Oct 24, 2026
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

Please review exact head e3f8c57fe1a2b250c7d7021073d65b92a5892f09. The previous review’s unconditional Lightpanda resource ceilings are removed. The updated PR body records the three browser-image builds, real renderer and lifecycle proof, and the investigated pre-existing headed Xvfb readiness limitation. Review only; no repair or merge action requested.

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. 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. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 24, 2026
@vincentkoc
vincentkoc merged commit d4eccd8 into main Oct 24, 2026
146 of 147 checks passed
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

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

Labels

docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: browser extensions: diffs maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S 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.

1 participant