Repository navigation
a Bot can have its own screen, browser and profile on a computer several Bots share - #40
Merged
Merged
Conversation
hexuria
force-pushed
the
gol/own-screen
branch
from
October 10, 2026 11:34
6b2f30f to
c324698
Compare
This was referenced Oct 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Box half of hexuria/opengrok-server#376. Stacked on #39: this branch includes its commit, so merge #39 first.
Why
Bots that share a computer share one screen, one Chromium, one profile and one keyboard. On 10 Oct, Bot A opened Facebook and Bot B showed Facebook too. The owner wants the shared screen to stay the default, with a Bot able to switch to its own screen, private sign-ins included, through a tool call or a switch in the app.
What
box-screen(new,/usr/local/bin/box-screen):up <bot>is idempotent. It allocates slot N (from 2, kept in~/.box-screens/in the home volume) and starts the slot's pieces:Xvfb :N;xfwm4 --display=:N;x11vncon127.0.0.1:590N, with the box's VNC password; itsDISPLAYis:N, sobox-release-keysreleases keys on that screen.{"bot","slot","display","profile","running"}.box-chromiumwithBOX_DISPLAY=:NandBOX_CHROME_PROFILE=~/chrome-profile/bots/<bot>.down <bot>stops the slot's Chromium, VNC, window manager and X server. It keeps the slot and the profile.listshows every Bot's slot and whether its screen is running.BOX_MAX_OWN_SCREENSown screens (default 4), and answers why past that.box-screenruns at a time (flock). The processes it starts never inherit the lock.Viewer: one websockify on 6080 for every screen (
--token-plugin TokenFile,/tmp/box-vnc-tokens/).sNreaches590N.get_target, so a server that doesn't know about own screens keeps working.CUA per screen:
/v1/cua/*route takes?display=:N(CuaConfig::on, which takes only:N).Page-in-front per screen:
box-active-tabwrites/tmp/box-active-tab.N.jsonfor its Chromium'sDISPLAY. The shared screen keeps/tmp/box-active-tab.json.GET /v1/chrome/active-tab?display=:Nreads it.BOX_SHARED_DISPLAY, notBOX_DISPLAY, because a Bot's Chromium is started with its ownBOX_DISPLAY. A live run caught that mistake.Other changes:
grok-box:GrokBox::on(":N")gives a client whose CUA, screenshot and active-tab calls name that screen. Commands and files are unchanged.box-chromiumopens onBOX_DISPLAYand fills the screen (--window-size,--window-position), likebox-chromium-pipe.box-refresh-extension(a computer kept from an older image runs the box extension's new background script, so the page's focus is reported there too #39's once-per-change worker clearing, moved into a script) runs for the shared profile at start, and for a Bot's profile atbox-screen up.Tests
New unit tests:
a_request_may_name_another_screen_of_the_box(only:Nis taken;; rm -rf /is refused);each_screen_has_its_own_report;a_client_on_another_screen_names_it_on_every_screen_call.cargo test --workspace --no-fail-fast: everything passes exceptjail::tests::absolute_inside_ok, which fails only on macOS and predates this. Clippy-D warningsand fmt are clean.Live check (throwaway container, this branch's image)
box-screen up cw_bob, twice:2) both times, the second already running:1, the Bot's page on:2:2onlya.html,focus:"text"(untouched); own reportb.html,focus:"password"s1→ shared;s2→ own;s9→ refuseddown cw_bobThe server half (Screen on every screen call, the
use_own_screentool,PUT /coworkers/{id}/computer/screen) and the app's switch follow.