INNER CODE UNIT · Python

_ensure_tmux_window

browser-use/bux · agent/box_agent.py:438

	def _ensure_tmux_window(
		window_id: str, *, launch: str, dsp_enabled: bool
	) -> None:
		"""Idempotently create the tmux window if it doesn't exist.

		We do this from the parent process (as bux, via sudo) BEFORE
		forking the pty — the pty path then attaches into a known-good
		session. Splitting create-vs-attach this way avoids "session
		not found" races and lets us seed `launch` only on first create.
		"""
		import subprocess

		def _run(args: list[str]) -> int:
			# box-agent already runs as bux (systemd User=bux), so direct
			# /usr/bin/tmux invocations share the same default socket as
			# the pty child. No sudo gymnastics needed.
			try:
				return subprocess.run(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…