Commit Graph

5 Commits

Author SHA1 Message Date
Teknium
6931f5a6b3 fix(browser): opt-in metrics name the local engine that served a browser_exec call
A local browser_exec call (hybrid ::local sidecar, cloud fallback, real profile) was labelled by re-reading
browser.engine after the call. A session created before the engine changed (a routed profile re-reads config
every call), or the real-profile Chromium, could therefore be counted as Lightpanda, and a Lightpanda session
as Chromium.

The route now carries the engine of the session it actually ran on ("local" or "lightpanda"; the real profile
is always Chromium) into the metrics label instead of reconstructing it from configuration.
2026-10-23 01:43:17 -07:00
Teknium
8685128003 fix(browser): browser.* settings are read through the effective config loader
browser.user_data_dir, chromium_args, cloud_provider and every other browser.* knob were read with
read_raw_config, which skips the managed overlay and ${VAR} expansion: a managed profile pin or
flag set was ignored, and ${HOME}/chrome-profile became a literal dir under HERMES_HOME. The session
layer's one reader (browser_session_cloud.browser_section) now uses load_user_config_effective, and
the other raw browser.* reads go through it or the same loader: browser_exec's cloud routing
(browser_use_cli._read_browser_cfg), the real-profile pin (browser_connect._browser_setting) and
/browser status's cdp_url (methods_browser, now browser_session_cdp.get_cdp_override_raw). Tests
that stubbed read_raw_config for browser.* now stub the effective loader.
2026-10-23 01:43:16 -07:00
Teknium
c44c4e9f9d fix(browser): label a locally-run browser_exec call 'local' in shared metrics
The handler named the configured cloud provider for every call, so hybrid ::local sidecar, cloud
fallback and real-profile calls counted against browserbase. The test now drives the real
_handle_browser_exec instead of rebuilding the wiring.
2026-10-23 01:42:19 -07:00
Teknium
058e31ecfd chore(browser): delete callerless session helpers
_LOCAL_SUFFIX, browser_in_sandbox() and is_local_mode() had no production caller; the tests that
patched browser_in_sandbox now pin the real placement seam (runtime.tool_placement) and the
is_local_mode assertion checks is_local_backend, the predicate production uses.
2026-10-23 01:41:56 -07:00
Teknium
855f03e3f7 feat(browser): Python Chromium launcher + browser_session layer (API for browser_exec-only)
New tools/ runtime that replaces agent-browser's one job for browser_exec:
- tools/browser_launcher.py: launch/track/stop the packaged Chromium
  (--remote-debugging-port=0 + DevToolsActivePort, per-(home, key)
  ephemeral user-data-dir, headless default, sandbox-bypass detection),
  parent-first stop, host-wide launch records + identity-checked orphan reap,
  attach to a Chromium already running on a persistent profile.
- tools/browser_session.py (+ _lifecycle, _cloud, _cdp, _real_profile,
  _sandbox): session cache per cache key with the existing creation
  precedence; every session carries cdp_url.
- tools/browser_url_policy.py: URL safety + SSRF helpers.
- browser_lightpanda: using_lightpanda_engine / lightpanda_engine_status.
- bot_desktop.browser reads browser.executable_path / browser.user_data_dir;
  env_for_agent is gone (the launcher passes binary + profile explicitly).
2026-10-23 01:41:23 -07:00