Skip to content

The agent that grows with you

fix(bot-screen): a headed browser request auto-starts the profile's screen like computer_use does

teknium1dc34b4757eb6
diff --git a/tests/tools/test_bot_desktop_browser.py b/tests/tools/test_bot_desktop_browser.py
index 1da352cc7de..7cd119fc6d1 100644
--- a/tests/tools/test_bot_desktop_browser.py
+++ b/tests/tools/test_bot_desktop_browser.py
@@ -8,6 +8,8 @@ import os
import socket
from pathlib import Path
+import pytest
+
from tools.bot_desktop import browser, runtime
@@ -237,3 +239,21 @@ def test_headless_shell_override_is_not_a_headed_browser(tmp_path, monkeypatch):
_, sys_exe = _install_browsers(tmp_path / "with-sys", monkeypatch, playwright=False, system=True)
monkeypatch.setenv("AGENT_BROWSER_EXECUTABLE_PATH", str(shell))
assert browser.executable() == sys_exe # a real headed browser elsewhere still wins over the override
+
+
[email protected]("headed", [True, False])
+def test_headed_browser_env_asks_the_screen_to_start_like_computer_use_does(monkeypatch, headed):
+ """Regression for #110050: `browser.headed: true` + `bot_desktop.auto_start: true` on a fresh headless
+ profile gave the headed child no DISPLAY, because only computer_use called ensure_started_for_tool() and
+ the browser env builder merely READ the published env. First browser use is a first use too — but only
+ when a window is asked for; a headless browser must never bring a screen up."""
+ from tools import browser_tool as bt
+ from tools import browser_tool_cloud as cloud
+
+ calls: list = []
+ monkeypatch.setattr(runtime, "ensure_started_for_tool", lambda: calls.append(1))
+ monkeypatch.setattr(runtime, "published_env", lambda: {})
+ monkeypatch.setattr(cloud, "_is_headed_mode", lambda: headed)
+ env = bt._build_browser_env()
+ assert isinstance(env, dict)
+ assert len(calls) == (1 if headed else 0)
diff --git a/website/docs/user-guide/features/bot-screen.md b/website/docs/user-guide/features/bot-screen.md
index d257a0828a7..4abba283513 100644
--- a/website/docs/user-guide/features/bot-screen.md
+++ b/website/docs/user-guide/features/bot-screen.md
@@ -120,9 +120,10 @@ Every bot's computer is one click away in three places of Hermes Desktop:
The screen is **off by default** and nothing starts it for you: click
**Start screen** in the pane, run `hermes computer-use screen start` on the
host, or set `bot_desktop.auto_start: true` if you want a headless host to
- start the screen by itself on the bot's first `computer_use` call (off so
- that installing TigerVNC never yields a screen nobody asked for). A headed
- browser opens on the screen once it is running.
+ start the screen by itself on the bot's first `computer_use` call or first
+ headed browser use (`browser.headed: true`) — off so that installing
+ TigerVNC never yields a screen nobody asked for. A headed browser opens on
+ the screen once it is running.
2. The pane streams the bot's desktop. The chip in the header says who is in
control: **Bot is in control** by default.
3. Click **Take over**. The border turns red, your keyboard and mouse now drive
@@ -202,7 +203,7 @@ hermes -p research computer-use screen start # another bot's screen
```yaml
bot_desktop:
geometry: "1440x900" # screen size; the viewer scales to fit the pane
- auto_start: false # set true to start on the first computer_use call
+ auto_start: false # set true to start on the first computer_use call or headed browser use
min_free_memory_mb: 1536 # refuse to start below this much free memory (0 = never check)
idle_stop_minutes: 30 # stop a screen nobody used for this long (0 = keep it up)
```
@@ -210,7 +211,8 @@ bot_desktop:
`auto_start` is off by default. Start the screen from the Desktop's Screen
pane (**Start screen**), from `hermes computer-use screen start`, or set the
flag to `true` for a headless host that should bring its screen up the first
-time the bot calls `computer_use` and no display is available.
+time the bot calls `computer_use` or opens a headed browser (`browser.headed:
+true`) and no display is available.
State lives under `<HERMES_HOME>/bot-desktop/` per profile (RFB Unix socket,
Xauthority, launcher log, per-profile xfconf).
diff --git a/website/docs/user-guide/features/computer-use.md b/website/docs/user-guide/features/computer-use.md
index 50047b6d6b6..99f3ad45d64 100644
--- a/website/docs/user-guide/features/computer-use.md
+++ b/website/docs/user-guide/features/computer-use.md
@@ -434,8 +434,8 @@ of screenshot context, not ~600K.
desktop over TigerVNC, streamed into Hermes Desktop, where you can
take over for logins and 2FA. You start it from the Desktop's
Screen pane or `hermes computer-use screen start`; it starts on
- first use only when `bot_desktop.auto_start: true` is set (off by
- default).
+ first use (the first `computer_use` call or headed browser use) only
+ when `bot_desktop.auto_start: true` is set (off by default).
Pure Wayland sessions need an XWayland bridge for screen capture
(cua-driver's Wayland inject path handles input independently).