7 Commits
Author SHA1 Message Date
Teknium 8dac3f319b fix(browser): an auto-started Bot Desktop screen is up before the browser profile is chosen
With browser.headed and bot_desktop.auto_start on a headless host, the first
local launch picked its target (no screen yet, so a throwaway profile) and
only then started the screen. Chromium opened on the Bot Desktop with a
different cookie jar from the dock's Browser icon. The screen now starts
first, so the launch selects the shared Bot Desktop profile.

Review: https://github.com/NousResearch/hermes-agent/pull/143146#discussion_r4351612954
2026-10-23 01:42:57 -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 bd1a7c390f fix(browser): key the real-profile browser per profile home
REAL_PROFILE_KEY was process-global: under multiplex any consent-off profile's local session stopped
another profile's live real-profile browser, and a consenting profile reused another's cookie jar.
The key is now hermes-real-profile@<home>; real-profile sessions carry it as launcher_key so the
staleness check applies (they still outlive their sessions until exit / consent-off).
2026-10-23 01:41:54 -07:00
Teknium 59dc0f76c3 fix(browser): stop the shared sandbox Chromium only after its last session, and detect it dead
Sessions placed in the terminal sandbox all attach to one in-sandbox Chromium, but teardown of the
session that launched it SIGTERMed it under the others. Sandbox sessions now share a per-profile
launcher key (same in-use check as host profiles; the launch pid + env are kept per key), and
_backend_dead rebuilds once that Chromium is gone, relaunched or behind a new port forward.
2026-10-23 01:41:51 -07:00
Teknium 938bb87ee9 fix(browser): rebuild a session whose shared browser was relaunched on a new endpoint
Cache keys on one persistent profile share a launcher key; after a crash another key relaunches it and
this key saw a live browser while still holding the dead cdp_url. Dead now also means the live browser's
cdp_url differs from the session's.
2026-10-23 01:41:49 -07:00
Teknium 5df6ccf7cc fix(browser): close regressions the ported tests caught
- janitor force-reap untracks the session (activity + owner + failures)
  before releasing it, so a teardown that keeps failing is not re-reaped
  every third cycle forever.
- orphan reap refuses a record without a start-time fingerprint (never
  signal on argv alone).
- an operator-pinned browser binary, even a missing one, never triggers the
  PM Chromium auto-download.
- local Chromium honours Bot Desktop placement through
  runtime.tool_placement(): refused raises, terminal starts the sandbox
  screen; neither falls back to a host browser.
- running_instance finds the browser pid by argv on Windows (no
  SingletonLock symlink there).
2026-10-23 01:41:24 -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