Skip to content

a Bot can be told to use its own screen on a computer it shares, and its clicks, keys, pages and fills land there - #383

Merged
hexuria merged 2 commits into
mainfrom
gol/own-screen
Oct 10, 2026
Merged

hexuria merged 2 commits into
mainfrom
gol/own-screen

Conversation

@hexuria

@hexuria hexuria commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Closes #376 (server half). The box half is hexuria/box#40, merged and pinned here (grok-box → c8ba740).

Why

Bots that share a computer share its one screen, browser and keyboard. On 10 Oct, Bot A opened Facebook and Bot B's screen showed it. The owner chose this behaviour:

  • the shared screen stays the default;
  • a Bot can be switched to its own screen, with its own browser and sign-ins, by telling it in chat or with a switch in the app;
  • the choice is saved until it is switched back.

What

The choice:

  • A bot row own-screen in computer_sharing: the same row as per-bot (own computer), so a Bot can never have both. No store change.
  • provision::screen_for reads it. It is Shared for a computer of its own.
  • provision::set_own_screen writes it, refuses a computer of its own or a group, and on switching back stops the Bot's own screen (Computer::close_screen, i.e. box-screen down).
  • Turning an own computer off clears the row only when it says per-bot, so it no longer wipes an own-screen choice.

Screen on every screen call:

  • opengrok_box::Screen { Shared, Own(bot) } is a parameter of act, screenshot, screen_url, active_tab_url, focused_field, open_url, run_recipe and devtools.
  • The docker box answers Own by running box-screen up <bot>, which is idempotent: a screen a restart stopped comes back on the next call. It then uses that display: GrokBox::on(":N"), the box-chromium env and the pipe env.
  • screen_url adds the slot's viewer token, and the screen proxy dials websockify?token=sN.
  • The bot id is checked as letters, digits, _ and - before any shell word is built.

Where the screen comes from:

  • ToolContext::screen is a cell shared by the turn's copies, so a switch mid-turn applies to the next action.
  • It is used by computer, open_url and run_recipe, the user-form fill, passkeys, the screenshot, the status (screen: "own" | "shared"), recipes and workflows.

Passkeys: the pipe is held per (box, screen). Restarting the browser now stops that profile's Chromium only (pkill -f --user-data-dir=<profile>). Before, pkill -x chromium closed every Bot's browser on the computer.

Tool: use_own_screen {own} is a new computer tool, in the manage_computer row.

Route: PUT /coworkers/{id}/computer/screen {own} → {screen}, added to the route map.

Crate ceilings (none raised): opengrok-server was 5 lines under its ceiling, so pure box-side code moved to opengrok-box, unchanged in behaviour:

  • viewer.rs: the viewer's port and path, the storage shim, the handshake read and the websocket dial;
  • devtools::held: the pipe registry.

opengrok-harness stays at 8000 through the opengrok_box::Target alias.

Tests

  • New: a_bot_on_its_own_screen_works_there_while_the_others_stay_on_the_shared_one. Bea is switched on and her fill's actions are all Own(bea); Ada's are all Shared. Each computer reports its screen. Switching back stops Bea's screen, and a computer of its own gets a 409. Fails without the feature: with screen_for forced to Shared, it fails at Bea's screen.
  • New unit tests: an_own_screen_is_read_from_box_screen (its answer, its refusal, an image without box-screen), only_a_plain_bot_id_names_a_screen, the_socket_path_is_the_shared_screens_or_one_bots_token, and use_own_screen reading in computer_desk.
  • Test fakes take the new parameter.
  • Run locally: the new tests, the route-map test, fmt, clippy -D warnings and the crate-size check. The full workspace run is left to CI, because the shared machine was too loaded to finish it here.

…its clicks, keys, pages and fills land there
@hexuria
hexuria merged commit 1097916 into main Oct 10, 2026
6 checks passed
hexuria added a commit that referenced this pull request Oct 13, 2026
main already carries this branch's work as 1097916 (#383's squash) plus
9c0935a's (#385) follow-on — every Bot on a shared computer now gets a
screen of its own without being asked — so the merge answers theirs
everywhere.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bots on a shared computer each get their own screen, browser and Chrome profile

1 participant