fix(bot-screen): restore the configured screen size when a human hands control back - #125329
Julientalbot wants to merge 1 commit into
Conversation
…s control back The lease holder may resize the screen (Xvnc runs -AcceptSetDesktopSize; noVNC does it with resizeSession, e.g. a phone viewer) and Xvnc keeps that size after hand-back, so the agent went on capturing and clicking a phone-sized desktop. Measured on a real Bot Screen: 1440x900 before a phone takeover, 393x607 during, still 393x607 after hand-back; 1440x900 after with this change. lease.release() now calls runtime.restore_geometry(profile) when control actually returns to the agent: xrandr -s to the configured size, or, since Xvnc drops that mode from its list after a SetDesktopSize, --newmode/--addmode/--output. Best effort, never raises; no-op when already at size or when the screen is down. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NNnn19Se2Kq86QQrAuGEZr
|
Independent exact-head check on
That directly covers restoring configured Bot Screen geometry after human hand-back, including the mode re-add path. |
At head 1. P1 — the mode re-add retargets the first Probe on the real head source (subprocess stubbed; provenance asserted via
Same function, same geometry, diverging target. The new test only feeds single-output fixtures ( 2. P2 — the restore runs up to four blocking Unverified / please confirm: both findings come from the post-image plus a stubbed-subprocess probe on a Windows host; I could not run a real Xvnc, so the line ordering of |
What does this PR do?
The lease holder may resize the Bot Screen. Xvnc runs
-AcceptSetDesktopSize, and the RFB filter lets the holder sendSetDesktopSize, which noVNC does withresizeSession(for example a phone viewer, so that sites render at the phone's size). Xvnc keeps that size after hand-back. The agent then goes on capturing and clicking a phone-sized desktop, andbot_desktop.geometryis no longer what the agent gets.With this change, handing control back restores the configured size.
Related Issue
Related: #108914 (Bot Screen), #92524 (taking over from a hosted instance, where phone viewers are the norm).
Type of Change
Changes Made
tools/bot_desktop/runtime.py: newrestore_geometry(profile_home=None).bot_desktop.geometry, it runsxrandr -s WxH.SetDesktopSize, so the function falls back to--newmode/--addmode/--output … --mode.profile_homeselects the profile's screen through the HERMES_HOME override, because the RFB bridge serves several profiles from one process.tools/bot_desktop/lease.py:release()calls it when control actually returns to the agent. It is not called for an ignored stale-viewer release, nor when the agent already holds. This is the single human→agent path, whichever process performs it (dashboard bridge, TUI gateway, CLI).tests/tools/test_bot_desktop_geometry.py: checks that:How to Test
Live evidence, on a real Bot Screen: TigerVNC Xvnc + Xfce from the
-desktopimage, with this patch applied to itsruntime.py/lease.py. The viewer is a phone-sized noVNC (resizeSession = true), followed by its hand-back.xrandr -s 1440x900fails with "Size 1440x900 not found in available modes"To reproduce the bug: take over with a noVNC client that has
resizeSessionon, from a small window, hand back, then runxrandr -qon the bot's display.Note for #121169:
restore_geometryonly goes throughpublished_env()andgeometry(). With terminal placement it will have to runxrandrinside the sandbox, like the rest ofruntime. I'm happy to adapt whichever lands second.Checklist
Code
tests/tools/test_bot_desktop_geometry.pyandtests/tools/test_bot_desktop_lease.py: 13 passed, 1 skipped (an existing Linux-only case, on macOS); live test on Debian as above-desktopimage (live)Documentation & Housekeeping
cli-config.yaml.example: N/A (uses the existingbot_desktop.geometry)CONTRIBUTING.md/AGENTS.md: N/A🤖 Generated with Claude Code
https://claude.ai/code/session_01NNnn19Se2Kq86QQrAuGEZr