Lightpanda upstream merged the AX-tree nodeId fix in
lightpanda-io/browser#2232. The TestLightpanda_KnownUpstreamGaps canary
fired on the latest image, so:
- Rename to TestLightpanda_Snapshot_AndEval and assert the snapshot
returns refs + non-empty text (instead of asserting it fails).
- Flip AX-snapshot in the compatibility matrix from gap to fully
supported. Replace the "Known upstream gap" section with a
"Minimum Lightpanda version" note pointing at the upstream PR.
- Eval works on Lightpanda when called with go-rod's expected function
form (e.g. "() => document.title"); only bare expressions fail, and
they fail on Chrome too. Fix the integration gap test and docs that
incorrectly attributed this to a Lightpanda bug.
- docker-compose.lightpanda.yml: add the missing
command: lightpanda serve ... — the image's entrypoint isn't
lightpanda, so without an explicit command the sidecar wouldn't
start.
Live testing surfaced three issues:
- Lightpanda numbers targets per-browser, and each conn is its own
browser, so every tab gets the same upstream targetID
("FID-0000000001"). Synthesize globally-unique "lp-N" keys for our
internal map so multi-tenant tab tracking works.
- page.Info() returns valid data once post-open then errors on
subsequent calls, which made ListTabs silently drop tabs. Cache URL
and Title at OpenTab time and read from the cache in ListTabs.
- rod.Browser.Close() calls Browser.close which Lightpanda doesn't
implement; the WS drops cleanly anyway. Swallow the error to quiet
the noisy log line.
Two Lightpanda upstream bugs are documented in docs/browser-backends.md
and exercised by TestLightpanda_KnownUpstreamGaps:
1. Accessibility.getFullAXTree returns nodeId as a JSON number
(CDP spec: string)
2. Runtime.evaluate rejects go-rod's function-apply wrapper
- docker-compose.lightpanda.yml: opt-in overlay running
lightpanda/browser:latest, wires GOCLAW_BROWSER_REMOTE_URL and
GOCLAW_BROWSER_BACKEND so the manager picks the right code path.
- docs/browser-backends.md: compatibility matrix vs Chrome (screenshot,
multi-tab, cookie sharing, etc.) and guidance on when to pick which.
Build-tag gated (//go:build integration), skipped unless
LIGHTPANDA_CDP_URL env is set. Covers:
- Golden path: open → snapshot → list → close
- Multi-tenant isolation: each tenant sees only its own tabs;
cross-tenant CloseTab is rejected
- Backend() reports lightpanda after Start
- Screenshot tool action returns an IsError result mentioning
lightpanda + snapshot
Pass cfg.Tools.Browser.Backend to browser.WithBackend when set, so the
"chrome" or "lightpanda" selector from config / GOCLAW_BROWSER_BACKEND
reaches the manager. Empty value still triggers /json/version
auto-detection in browser.Start().
Lightpanda requires one CDP connection per tab (vs Chrome's shared-WS
model). Add a Backend selector in pkg/browser/, branched lifecycle, and
per-tab connection tracking via pageConns.
- Backend type (chrome | lightpanda), WithBackend option, Backend()
accessor. Auto-detected from /json/version when unset.
- Lightpanda OpenTab mints a fresh conn, calls
Target.createBrowserContext (required per-conn) + createTarget.
- ListTabs / getPage are local-map only on Lightpanda (no /json/list,
no auto-reconnect).
- Shared closeManagedPageLocked helper used by CloseTab, evict, and
the idle-page reaper.
- Screenshot tool action errors out on Lightpanda (returns a
placeholder image upstream; route the agent to snapshot instead).
Introduces an explicit backend selector for the browser automation
tool ("chrome" or "lightpanda"). Empty means auto-detect, which will
be wired in a later commit. Chrome remains the default behavior.