Skip to content

The agent that grows with you

fix(bot-screen): quiet xkbcomp keysym noise, log an ignored release, hide Chrome-for-Testing infobars

teknium121d3c77300ee
diff --git a/tools/bot_desktop/browser.py b/tools/bot_desktop/browser.py
index 08d7489ee3d..1c4db251b2f 100644
--- a/tools/bot_desktop/browser.py
+++ b/tools/bot_desktop/browser.py
@@ -57,7 +57,10 @@ def dock_command(exe: str, user_data_dir: str) -> str:
"""Shell line the dock's Browser icon runs. ``--remote-debugging-port=0`` makes a human-started
instance attachable (Chromium writes the chosen port to ``<user-data-dir>/DevToolsActivePort``);
first-run / default-browser dialogs would sit between the human and the bot's tabs."""
- return f"{exe} --user-data-dir={user_data_dir} --remote-debugging-port=0 --no-first-run --no-default-browser-check"
+ # --test-type hides the "Chrome for Testing is only for automated testing" and unsupported-flag
+ # (--no-sandbox as root) infobars, which otherwise sit at the top of the human's takeover view.
+ return (f"{exe} --user-data-dir={user_data_dir} --remote-debugging-port=0 --no-first-run "
+ f"--no-default-browser-check --test-type")
def running_instance_cdp_port(user_data_dir: str, *, exclude_session: Optional[str] = None) -> Optional[int]:
diff --git a/tools/bot_desktop/launcher.sh b/tools/bot_desktop/launcher.sh
index 9eb106b1ed7..4efecdaf9c4 100755
--- a/tools/bot_desktop/launcher.sh
+++ b/tools/bot_desktop/launcher.sh
@@ -230,7 +230,7 @@ Xvnc "$DISPLAY" -geometry "$GEOM" -depth "$DEPTH" -dpi 96 \
-rfbport -1 -rfbunixpath "$HERMES_BD_SOCKET" -rfbunixmode 0600 \
-SecurityTypes None -AlwaysShared -AcceptSetDesktopSize -FrameRate 30 -SendCutText=0 \
-desktop "hermes:$HERMES_BD_PROFILE" -auth "$XAUTHORITY" -nolisten tcp \
- -Log '*:stderr:30' &
+ -Log '*:stderr:30' 2> >(grep -v --line-buffered 'Could not resolve keysym' >&2) &
XVNC_PID=$!
trap 'kill "$XVNC_PID" 2>/dev/null || true' EXIT
for _ in $(seq 1 100); do
diff --git a/tools/bot_desktop/lease.py b/tools/bot_desktop/lease.py
index 33b12f20097..442a68b472f 100644
--- a/tools/bot_desktop/lease.py
+++ b/tools/bot_desktop/lease.py
@@ -15,6 +15,7 @@ an action admitted under one lease can tell that control changed underneath it.
from __future__ import annotations
import json
+import logging
import os
import threading
import time
@@ -29,6 +30,8 @@ try:
except ImportError: # Windows/macOS without fcntl: computer_use imports this module on every call, and no
fcntl = None # multi-process Bot Desktop exists there, so the cross-process lock degrades to a no-op.
+logger = logging.getLogger(__name__)
+
AGENT = "agent"
HUMAN = "human"
_POLL_SECONDS = 0.25
@@ -170,6 +173,9 @@ def release(viewer_id: Optional[str] = None, *, profile_key: Optional[str] = Non
closing its window must not yank control from the one who took over after it)."""
def _m(lease: Lease) -> bool:
if viewer_id is not None and lease.holder == HUMAN and lease.viewer_id != viewer_id:
+ # Ignored, not an error: the returned lease still shows the real holder. Logged so a
+ # caller that never inspects the return value leaves a trace.
+ logger.info("bot-desktop lease: release by %r ignored, another viewer holds", viewer_id)
return False
lease.holder, lease.viewer_id, lease.since, lease.reason = AGENT, None, time.time(), ""
lease.pending_handoff = None # "hand back" answers an open request even if nobody formally took over