7 Commits
Author SHA1 Message Date
Teknium f720cbb14c fix(browser): shutdown closes each browser session under the profile that owns it
cleanup_all_browsers (gateway shutdown, atexit) ran every teardown in the launch profile's scope,
unlike the janitor: a multiplexed profile's cloud session was closed through the launch profile's
provider (usually none), so it stayed open and billing until the provider's own timeout. Each
session is now torn down under its recorded owner home and secret scope.
2026-10-23 01:43:16 -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 1bf137e994 fix(browser): launcher state lives in a private per-profile dir
Chromium launch records move to <HERMES_HOME>/cache/browser/chromium-records (0700, used only when it is
a real dir of this user closed to other writers), the reaper removes only dirs under that home's 0700
ephemeral root, and it walks every profile the process serves (launch home, launched-for homes, session
owner homes) by path, since the janitor and atexit run outside any profile scope.
2026-10-23 01:41:29 -07:00
Teknium d34d78523d chore(browser): health ratchet clean (Path import, janitor thread scope note) 2026-10-23 01:41:24 -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