The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
chore(process): mark the browser/desktop spawns that must stay detached, with the reason
kshitijk4poordd7a47917b2a
diff --git a/hermes_cli/browser_connect.py b/hermes_cli/browser_connect.pyindex 3cc15924698..c61fd0c931a 100644--- a/hermes_cli/browser_connect.py+++ b/hermes_cli/browser_connect.py@@ -1055,7 +1055,9 @@ def manual_chrome_debug_command(port: int = DEFAULT_BROWSER_CDP_PORT, system: stdef _detach_kwargs(system: str) -> dict:if system != "Windows":- return {"start_new_session": True}+ # /browser connect launches the USER's debug browser: it must outlive this Hermes (the connection persists in+ # BROWSER_CDP_URL and a later session re-attaches to it), and it is never ours to stop.+ return {"start_new_session": True} # detached-spawn: ok — the user's browser, meant to outlive Hermesflags = (getattr(subprocess, "DETACHED_PROCESS", 0)| getattr(subprocess, "CREATE_NEW_PROCESS_GROUP", 0))return {"creationflags": flags} if flags else {}diff --git a/tools/bot_desktop/install.py b/tools/bot_desktop/install.pyindex 80b4f6337a3..db6031835da 100644--- a/tools/bot_desktop/install.py+++ b/tools/bot_desktop/install.py@@ -141,9 +141,10 @@ def _run(cmd: str, *, ask_password: Callable[[], str], on_line: Callable[[str],stdin_payload = password + "\n"on_line(f"$ {cmd}")env = {"DEBIAN_FRONTEND": "noninteractive", "LC_ALL": "C.UTF-8"}+ # Short-lived and awaited: the group exists so _kill_group's timeout kill reaches apt/dnf under sudo.proc = subprocess.Popen( # windows-footgun: ok — Linux-only (is_supported_host)argv, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,- env={**os.environ, **env}, start_new_session=True)+ env={**os.environ, **env}, start_new_session=True) # detached-spawn: ok — awaited, group-killed on timeouttry:if stdin_payload is not None:proc.stdin.write(stdin_payload.encode("utf-8")) # type: ignore[union-attr]diff --git a/tools/bot_desktop/runtime.py b/tools/bot_desktop/runtime.pyindex 3fac333c2bd..b4f757e07fc 100644--- a/tools/bot_desktop/runtime.py+++ b/tools/bot_desktop/runtime.py@@ -744,9 +744,11 @@ def _spawn_and_wait(sd: Path, wait_seconds: float) -> DesktopStatus:child_env["HERMES_BD_BROWSER_EXEC_LINE"] = dock_exec_line(*browser)# Truncated per start: the log is a diagnostic for THIS launch, and nothing rotates it otherwise.log = open(sd / "launcher.log", "wb")+ # The profile's screen outlives whichever CLI/gateway started it, on purpose: launcher.pid carries+ # (pid, create_time) so any later process reports/stops it, and the display watcher idle-stops it.proc = subprocess.Popen( # windows-footgun: ok — Linux-only runtime (is_supported_host)["bash", str(_LAUNCHER)], env=child_env, stdin=subprocess.DEVNULL, stdout=log, stderr=log,- start_new_session=True, close_fds=True)+ start_new_session=True, close_fds=True) # detached-spawn: ok — per-profile screen, outlives its starterlog.close()born = _create_time(proc.pid)(sd / "launcher.pid").write_text(f"{proc.pid} {born if born is not None else 0}", encoding="utf-8")