Skip to content

The agent that grows with you

chore(bot-desktop): mark the X11 lock/socket paths for main's no-/tmp-literal guard

teknium159a81c49ca5c
diff --git a/tools/bot_desktop/launcher.sh b/tools/bot_desktop/launcher.sh
index c96d850f4ac..93953fa39cd 100755
--- a/tools/bot_desktop/launcher.sh
+++ b/tools/bot_desktop/launcher.sh
@@ -44,9 +44,10 @@ export XAUTHORITY="$HERMES_BD_XAUTH"
# running server (another profile may have taken this number) and is never touched — Xvnc then
# fails to start on it and runtime.py reports that instead of us disrupting the other desktop.
rm -f "$HERMES_BD_SOCKET"
+# no-tmp: ok — the X11 protocol fixes its lock and socket under /tmp; this is not our scratch dir
xlock="/tmp/.X${HERMES_BD_DISPLAY_NUM}-lock"
if [[ -e "$xlock" ]] && ! kill -0 "$(tr -d ' ' < "$xlock" 2>/dev/null)" 2>/dev/null; then
- rm -f "$xlock" "/tmp/.X11-unix/X${HERMES_BD_DISPLAY_NUM}"
+ rm -f "$xlock" "/tmp/.X11-unix/X${HERMES_BD_DISPLAY_NUM}" # no-tmp: ok — X11 display socket, fixed by the protocol
fi
: > "$XAUTHORITY"; chmod 600 "$XAUTHORITY"
# The cookie goes in on stdin, not argv: a command line is readable by every local user via ps.
diff --git a/tools/bot_desktop/runtime.py b/tools/bot_desktop/runtime.py
index f7b17d3768d..1af9d16625b 100644
--- a/tools/bot_desktop/runtime.py
+++ b/tools/bot_desktop/runtime.py
@@ -178,7 +178,7 @@ def _recorded_launcher_pid() -> Optional[int]:
return int(pid_s) if pid_s.isdigit() and born_s else None
-_X_LOCK_DIR = Path("/tmp") # where X servers write .X<n>-lock (tests point it at a scratch dir)
+_X_LOCK_DIR = Path("/tmp") # no-tmp: ok — X servers write .X<n>-lock here by protocol (tests point it at a scratch dir)
_X_UNIX_TABLE = Path("/proc/net/unix") # the kernel's list of bound Unix sockets (tests point it at a fixture)
@@ -197,6 +197,7 @@ def _x_socket_bound(num: int) -> bool:
lines = _X_UNIX_TABLE.read_text(encoding="utf-8").splitlines()
except OSError:
return False
+ # no-tmp: ok — detects the X server's display socket at the path the X11 protocol fixes
return any(line.split()[-1].lstrip("@") == f"/tmp/.X11-unix/X{num}" for line in lines if line.strip())
diff --git a/website/docs/user-guide/features/bot-screen.md b/website/docs/user-guide/features/bot-screen.md
index 4abba283513..3a08307ed85 100644
--- a/website/docs/user-guide/features/bot-screen.md
+++ b/website/docs/user-guide/features/bot-screen.md
@@ -268,13 +268,14 @@ Xauthority, launcher log, per-profile xfconf).
WSL2 counts as a supported Linux host: `screen status` reports it as such and
the pane is offered. One WSLg quirk gets in the way of the first start: WSLg
+<!-- no-tmp: ok — the X11 socket directory is fixed by the protocol, not a scratch path -->
mounts `/tmp/.X11-unix` read-only, so `Xvnc` cannot create its display socket
and dies with `Cannot establish any listening sockets` in `launcher.log`.
Replace the mount with a writable directory before starting the screen:
```bash
-sudo umount /tmp/.X11-unix
-sudo mkdir -p /tmp/.X11-unix && sudo chmod 1777 /tmp/.X11-unix
+sudo umount /tmp/.X11-unix # no-tmp: ok — X11 socket directory, fixed by the protocol
+sudo mkdir -p /tmp/.X11-unix && sudo chmod 1777 /tmp/.X11-unix # no-tmp: ok — same
```
The mount comes back on the next WSL restart; repeat the two commands then.