The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(browser): Windows exit stops no harness daemon again
kshitijk4pooraa6b60e3e49a
diff --git a/tests/tools/test_browser_use_cli_owned_daemon.py b/tests/tools/test_browser_use_cli_owned_daemon.pyindex c38e63d3954..cbd6146a3a0 100644--- a/tests/tools/test_browser_use_cli_owned_daemon.py+++ b/tests/tools/test_browser_use_cli_owned_daemon.py@@ -311,3 +311,11 @@ def test_a_managed_worker_never_owns_its_harness_daemon(fake_daemon, registered,assert registered == []++def test_windows_exit_stops_no_harness_daemon(monkeypatch):+ """Windows records no ownership and its exit never stopped a browser_exec-only process's daemons:+ reloading every driven one would stop a shared daemon another live Hermes is using."""+ monkeypatch.setattr(browser_use_cli.os, "name", "nt")+ monkeypatch.setattr(browser_use_cli, "_driven_daemons", {("", "", "", "", "default"): "home"})+ monkeypatch.setattr(browser_use_cli, "_reload_daemons", lambda daemons: pytest.fail(f"reloaded {daemons}"))+ browser_use_cli.stop_owned_harness_daemons()diff --git a/tools/browser_use_cli.py b/tools/browser_use_cli.pyindex d5578dd247c..a5a5af267c9 100644--- a/tools/browser_use_cli.py+++ b/tools/browser_use_cli.py@@ -641,9 +641,8 @@ def stop_owned_harness_daemons() -> None:"""Stop only the harness daemons this process owns (``_owned_daemon_groups``: started by its owncommands). The exit handler uses this: a daemon another live Hermes started on the same name wasdriven here too, but it is that Hermes's to stop. Windows records no ownership (``_own_harness_daemon``- is POSIX-only), so there every driven daemon is stopped, as before."""+ is POSIX-only) and its exit never stopped a browser_exec-only process's daemons, so nothing to do."""if os.name != "posix":- stop_harness_daemons()returnwith _owned_daemon_groups_lock:owned = dict(_owned_daemon_groups)