Skip to content

Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.

fix: sessions won't delete socket of live daemon with stale PID

ShawnPana1711a8918ea0
diff --git a/browser_use/skill_cli/main.py b/browser_use/skill_cli/main.py
index 99857004b..0fe5d50bd 100755
--- a/browser_use/skill_cli/main.py
+++ b/browser_use/skill_cli/main.py
@@ -973,9 +973,10 @@ def _handle_sessions(args: argparse.Namespace) -> int:
probe = _probe_session(name)
if not probe.pid_alive:
- # Dead — clean up stale files
- _clean_session_files(name)
- continue
+ # Don't delete if socket is still reachable — daemon alive despite stale PID
+ if not probe.socket_reachable:
+ _clean_session_files(name)
+ continue
# Terminal state + dead PID already handled above.
# If phase is terminal but PID is alive, the daemon restarted and