Repository navigation
Browser and WebArena site adapters for the browser tracks - #350
Conversation
There was a problem hiding this comment.
This review found 3 issue(s), including 3 blocking issue(s).
| return str(self.topology["label"][language]) | ||
|
|
||
|
|
||
| def _base_url(urls: list[Any] | tuple[Any, ...], label: str) -> str: |
There was a problem hiding this comment.
|
|
||
| def pinned_image_version(engine: str, root: Path | None = None) -> str | None: | ||
| """Return the version the public image recipe pins with ``ARG <ENGINE>_VERSION``.""" | ||
| recipe = (repository_root() if root is None else root) / IMAGE_RECIPES / f"{engine}.Dockerfile" |
There was a problem hiding this comment.
This makes public replay with Moli (including the default engine set) fail from an installed wheel: repository_root() resolves to the installed package parent, but the Dockerfiles under examples/ are not included in tool.webstone.bundled-data or package data. Consequently this returns None, and _verify_pinned_versions() raises even for the correctly pinned image. Bundle the required recipe and resolve it with bundled_data_path() (or package equivalent pin metadata), and cover version discovery from an installed distribution.
| if any(module.startswith(package + ".") for package in ADAPTER_PACKAGES): | ||
| return False |
There was a problem hiding this comment.
This exemption also disables layering checks for browser adapters: layering_violations() uses is_shared(), and these modules have no own_track, so they are now skipped entirely. An adapter importing a track-specific runner would therefore pass the architecture test, despite remaining part of the shared environments package. Apply the adapter exemption only in instance_literals() so the shared-package import boundary remains enforced.
4988507 to
5c4c688
Compare
There was a problem hiding this comment.
This review found 3 issue(s), including 3 blocking issue(s).
| return str(self.topology["label"][language]) | ||
|
|
||
|
|
||
| def _base_url(urls: list[Any] | tuple[Any, ...], label: str) -> str: |
|
|
||
| def pinned_image_version(engine: str, root: Path | None = None) -> str | None: | ||
| """Return the version the public image recipe pins with ``ARG <ENGINE>_VERSION``.""" | ||
| recipe = (repository_root() if root is None else root) / IMAGE_RECIPES / f"{engine}.Dockerfile" |
There was a problem hiding this comment.
This lookup breaks installed-package replay runs that include Moli (including the default engine set). Outside a checkout, repository_root() returns the installation's package parent, but the Dockerfiles are neither package data nor listed in tool.webstone.bundled-data. Consequently this returns None and _verify_pinned_versions() aborts even for a correctly versioned container. Bundle the required recipes and resolve them through bundled_data_path() (or ship equivalent generated version metadata), and cover version lookup from an installed wheel.
| if any(module.startswith(package + ".") for package in ADAPTER_PACKAGES): | ||
| return False |
There was a problem hiding this comment.
This exemption also disables dependency-layer checks for every browser adapter: layering_violations() uses is_shared(), and these modules have no own_track, so they are skipped entirely. An adapter could now import a track-specific runner without failing the architecture test. Keep adapters classified as shared for layering and apply the adapter exemption only in instance_literals().
There was a problem hiding this comment.
✅ Re-review complete · e379e03
No findings in this incremental review.
Each engine (chromium, moli, lightpanda, obscura, kitesurf) is one module in harness/environments/browser/ declaring its launch command, container image and CDP port, version command, hosted-CDP hook and capability flags. The Playwright tool, catalog runner, remote cohort, runtime identity and public replay read flags and adapter data instead of branching on engine names; engine choices derive from the registry. Profile participant parsing moves to harness/environments/participants.py, and the Browser Use runner takes its browsers from the report profile. The public replay reads its pinned browser version from its image recipe.
…ul flags harness/environments/webarena/sites.py declares one adapter per WebArena site: form and session login, auto-login headers, URL initialisation, Magento, health-check, PHP, baseline and admin-HTTPS behaviour. Labels live in topology.json beside ports, and the stateful flag is the topology's mutable flag. The public replay environment, environment manager, Rainbond slices, BrowserTool login, remote cohort checks, catalog contracts and both reports read adapters instead of site-name sets and label maps.
…er layering checks, drop unused helper Installed public replay runs read the recipe through bundled_data_path. Browser adapter modules are exempt only from the instance-literal scan; the layering scan still covers them. The unused WebArena _base_url helper is removed.
e379e03 to
47a9b71
Compare
|
Rebased on main after #345, #349, #351, #346, #348 and #358 (head 47a9b71).
|
Purpose
Browser and WebArena-site knowledge was spread over shared runners, tools and reports as name checks (
engine == "kitesurf",site in {"gitlab", "reddit"}) and as several registries that disagreed. This PR gives each browser engine one adapter, and each WebArena site one adapter, and makes shared code read declared data and capability flags.flowchart LR subgraph B["harness/environments/browser/"] R["BROWSERS registry<br/>BrowserAdapter + flags"] C[chromium.py] --> R M[moli.py] --> R L[lightpanda.py] --> R O[obscura.py] --> R K[kitesurf.py] --> R end P["environments/participants.py<br/>profile_engines, participant_registry"] subgraph W["harness/environments/webarena/"] T["topology.json<br/>ports, labels, mutable"] --> S["sites.py<br/>WEBARENA_SITES: login, reset, flags"] end R --> PT[Playwright tool] & CR[catalog runner] & RE[remote cohort] & PR[public replay] & BU[Browser Use runner] & LX[Lexbench] P --> BU & RP[replay reports] & BUR[Browser Use report] S --> RT[BrowserTool login / ensure_site] & PE[public replay environment] & RC[remote cohort checks] & RB[Rainbond / manager] & REP[report labels]What moved / was removed
#321 browser adapters
environments/browser.pybecame the packageenvironments/browser/;BrowserAdapterdeclares label, capability flags, container image (+ env override), CDP port, version command, local launch command and hosted-CDP hook. Five adapter modules register themselves.multiple_pages,network_reset_cdp,storage_cdp,context_request_cookie_sharing,native_login_form_submit,playwright_har_capture,hosted_default_context,dom_login_readiness,document_observer,layout_publication,viewport_observer,host_resolver_rules,request_bridge,reference.BROWSER_ADAPTERS,ENGINE_LABELS,DEFAULT_BROWSER_IMAGES,ENGINE_PORTS, theremote_execution._browser_commandif-chain,catalog_runner._kitesurf_cdp_config/_probe_kitesurf_runtime/_chromium_host_resolver_rules(now_hosted_cdp_config/_probe_hosted_runtime/_host_resolver_rules),public_webarena.runner.MOLI_VERSION.--engine= all adapters; remote cohort--engine= adapters with the full CDP surface (chromium,moli, as before); public replay--enginesdefault = adapters with a container image.ARG <ENGINE>_VERSIONinexamples/trajectory_replay/public_webarena/docker/<engine>.Dockerfile) instead of a duplicated constant.reference(Chromium).participant_registry,bind_participant,resolve_participant_id, newprofile_engines) moved to sharedharness/environments/participants.py; Browser UseParticipants.from_profileand the replay reports use it.--profile) instead of a module constant.layout_publication.#325 WebArena site adapters
environments/webarena/sites.py: oneSiteAdapterper site with form login (public replay), session login (BrowserTool), auto-login header, URL-initialisation mode, Magento/health-check/PHP/baseline/admin-HTTPS flags. Labels (en/zh) added totopology.json;stateful= topologymutable._login_shopping/_shopping_admin/_reddit/_gitlaband the per-site reset chain inpublic_webarena/webarena_environment.py, itsSTATEFUL_SITES,manager.STATEFUL_SITES,rainbond.STATEFUL_SITES,config.SITES(nowsites.SITE_NAMES), per-site branches inruntime.login_context/ensure_site,catalog_contractssite sets,remote_runtimesite checks,remote_executionadmin checks,browser_use.selection.ALLOWED_SITESliteral,browser_use.report.SITE_LABELSliteral and hardcoded site filter options,webarena_report._catalog_site_labelsmap (and its fourcatalog.site.*catalog entries).bootstrap_postmill_session/bootstrap_postmill_browser_sessionmoved fromruntime.pytosites.py.Breaking changes
python -m harness.browser_use.runner(andexamples/browser_use/run.sh) now requires--profile <report profile>;BROWSER_USE_PROFILEsupplies it to the wrapper. The profile'senginesselect the browsers, andmodelsmust include--model.harness.environments.webarena.config.SITES→harness.environments.webarena.sites.SITE_NAMES.run_replay_task(..., backend="playwright")now requires an explicitengine(no implicit Chromium default).Allowlists
harness.environments.browserremoved;reporting.visual -> chromiumremains). The scan now treats child modules ofharness.environments.browseras adapters and takes browser names fromBROWSERS.Baselines
tests/baselinesunchanged. Scorer identity unchanged (lexbench-webfetch version→scoring_source_sha256 0fe89317…169e).Hash bindings left as they are
lexbench/resource_matrix.pyandlexbench/resource_profiles.pystill name Moli: their own bytes are bound by frozen protocols (orchestrator_sha256), so they were not edited.scripts/run_remote_three_method_cohort.pyuntouched.remote_execution.py,remote_runtime.pyandwebarena_replay.pychanged; cohort receipts record their hashes at run time, but nothing verifies them against current source (aggregation verifies manifest/dataset/binary/site-map/reset hashes only).reporting/visual.py,*report_visual.py) untouched, so existing visual receipts keep verifying.Not converged (follow-up)
CdpHarRecorderclasses remain: they are not equivalent (different API, redaction of auth headers/cookies, creator namewebstone-cdp, Playwright transport). Merging would change recorded HAR evidence.--engines,--engine); the curated WebArena replay already readsmethodsfrom its plan.trajectory_replay/report.pystill embeds Moli-specific timing prose (MOLI_TIMING_*): report content that belongs in bound content.environments/webarena/(config deployment contract, Map setup) — the site-adapter package.Verification
uv run --frozen --all-extras python -m pytest -n 8 tests/trajectory_replay tests/browser_use tests/environments tests/baselines tests/test_architecture_*.py tests/test_source_language_policy.py tests/test_documented_paths.py+ Lexbench tests → 2854 passed, 5 skipped (base main: all passing).harness.environments|trajectory_replay|browser_use|lexbench(35 files) → 985 passed, 1 skipped.make lint-check→ clean.Part of #321 (remaining: replay runners still take participants from CLI/registry, Moli timing prose in the replay report)
Part of #325 (remaining: two non-equivalent login protocols and HAR recorders, see above)