Skip to content

App: a Bot's saved copies, and restoring one - #2018

Merged
davidmckayv merged 1 commit into
mainfrom
app/workspace-restore
Nov 22, 2026
Merged

davidmckayv merged 1 commit into
mainfrom
app/workspace-restore

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

What

The screens for a computer's daily saved copies, on a Bot's Computer page, built on the operations in #2017 (getWorkspaceSnapshots, restoreComputer). Stacked on that branch.

  • Saved copies section: the copies of the computer this Bot runs on for the person reading, newest first. A daily copy reads as its date in the person's locale ("Saturday, November 21 at 3:00 AM"); the one saved before a restore reads "Before restore, ". There is an empty state for a computer with none yet. The section is drawn only when the read answers available: true. A 403, a 404 or available: false draws nothing.
  • Restore (outline, small) on each row only where the read says canRestore. It opens a confirmation that says, in plain words, that every file and browser sign-in goes back to how it was then, for every Bot on that computer; that OpenBot saves the computer as it is now first, so it can be undone; and that the computer restarts and routines wait. Buttons: Cancel and "Restore it" ("Restoring…" while sending). A refusal such as 409 COMPUTER_RESTORE_RUNNING shows the server's sentence beside the buttons, and the dialog stays open.
  • Status at the top of the section. While a restore runs, a notice says so and the copies are read again every 5 s; every Restore waits. A failed restore shows the server's error in the page's destructive notice. A finished one shows a quiet line, pointing at the "Before restore" copy while it is still listed. When a restore ends, the computer's status and the computers list are read again.
  • Admins: each other person's row in "Its computer" gets "Restore…". It opens that computer's copies (?computer=<row.computer>) and restores with computer in the body, using the same confirmation stacked over it. The admin's own row has no "Restore…", because their own copies are in the section below.
  • The "Its computer" rows hold their text to a readable width. With a third button on a narrow window, the buttons now wrap under the text on every row, so a name is no longer squeezed to one word per line.

Data goes through the generated client only: workspaceSnapshotsQueryOptions and restoreComputerMutationOptions in lib/computers.

Why

Restoring a computer is something a person chooses. Nothing restores automatically, and the screen never picks a copy for them: they see each copy's date, read what a restore does, and confirm it.

Screenshots

The real page in its Bot frame, drawn by headless Chromium with the app's stylesheet against a stand-in server (app/tests/workspace-snapshots-layout.test.tsx, run with OPENBOT_APP_BROWSER=1, and OPENBOT_APP_SHOTS=<dir> to save them). Each was checked in light and dark, at 1024 px and 390 px:

  • the list after a restore that went well
  • the confirmation, and a 409 refusal shown beside its buttons
  • a restore running, and a restore that failed
  • an admin's view with "Restore…" on the other people's rows, the dialog of another person's copies, and the confirmation stacked over it

The test also asserts that the page never scrolls sideways and that every dialog stays inside the window.

Checks

  • bun test app/tests/workspace-snapshots.test.tsx: 7 tests, run against a stand-in server at the API's addresses. They cover the labels and newest-first order; the read-only view with no Restore; the section hidden for available: false, a 403 and a 404; the empty state; a confirm sending restoreComputer with {snapshotId} and an Idempotency-Key, then the running notice; a restore already running on load; a 409 shown in the dialog; and an admin restoring another person's computer with {snapshotId, computer}, with "Restore…" only on that person's row.
  • OPENBOT_APP_BROWSER=1 bun test app/tests/workspace-snapshots-layout.test.tsx: 16 pass.
  • The existing Computer page tests (no-bot-computers, personal-settings, settings-computer-page, computer-fleet-pages, bot-delete-stops-computer-reads), the copy-rule tests and api/client-boundary.test.ts pass.
  • bun run --cwd app typecheck, biome lint --error-on-warnings . and bun run api:lint are clean.

@davidmckayv
davidmckayv force-pushed the app/workspace-restore branch from 39579b2 to 57fbb6e Compare November 22, 2026 05:33
@davidmckayv
davidmckayv force-pushed the api/workspace-snapshots branch from f952be7 to 7326203 Compare November 22, 2026 06:26
@davidmckayv
davidmckayv force-pushed the app/workspace-restore branch from 57fbb6e to c67d63a Compare November 22, 2026 06:26
@davidmckayv
davidmckayv force-pushed the api/workspace-snapshots branch from 7326203 to a1fc568 Compare November 22, 2026 07:11
@davidmckayv
davidmckayv force-pushed the app/workspace-restore branch from c67d63a to f6cf773 Compare November 22, 2026 07:11
@davidmckayv
davidmckayv force-pushed the api/workspace-snapshots branch from a1fc568 to 49f4fc9 Compare November 22, 2026 10:11
Base automatically changed from api/workspace-snapshots to main November 22, 2026 10:16
A section on a Bot's Computer page, Saved copies, shows the daily copies of the computer this Bot
runs on for the person reading, newest first, and the one saved just before each restore. It is
drawn only where this OpenBot keeps copies and the person may see them: available false, or a
refused read, draws nothing.

Restore asks first, in plain words: every file and browser sign-in on the computer goes back to
how it was then, for every Bot on it; OpenBot saves the computer as it is now first, so it can be
undone; the computer restarts and routines wait. Nothing is restored unless a person picks a copy
and confirms. A refusal (a restore already running) is said beside the buttons.

While a restore runs the copies are read again every 5 seconds and a notice says so at the top;
when it ends, the computer's status and the list of computers are read again. A failed restore
shows the server's sentence; a done one points at the copy saved just before, while it is listed.
Restore shows only where the read says the person may restore.

An admin sees a Restore... button on each other person's computer this Bot runs on, which opens
that computer's copies and restores it by name, with the same confirmation.

Reads and writes go through the generated getWorkspaceSnapshots and restoreComputer, from
queryOptions and mutationOptions factories in lib/computers.

The Its computer rows now hold their words to a readable width, so with a third button the
buttons wrap under the words on a narrow window instead of squeezing the name.
@davidmckayv
davidmckayv force-pushed the app/workspace-restore branch from f6cf773 to a2c8687 Compare November 22, 2026 10:17
@davidmckayv
davidmckayv merged commit 3aca90a into main Nov 22, 2026
33 checks passed
@davidmckayv
davidmckayv deleted the app/workspace-restore branch November 22, 2026 10:22
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.

1 participant