Skip to content

API: a computer's daily saved copies, and restoring one - #2017

Merged
davidmckayv merged 2 commits into
mainfrom
api/workspace-snapshots
Nov 22, 2026
Merged

davidmckayv merged 2 commits into
mainfrom
api/workspace-snapshots

Conversation

@davidmckayv

Copy link
Copy Markdown
Contributor

What

Two operations on the computer a Bot runs on, so a person can get their computer back after a Bot (or they) wiped it:

  • GET .../computers/{botId}/workspace-snapshots (getWorkspaceSnapshots): the computer's saved copies of its files and browser sign-ins, newest first. One is saved a day and the last 7 are kept; one more is saved just before every restore (kind before-restore). Also the latest restore and how it ended, available (false where this OpenBot keeps no copies) and canRestore for the caller.
  • POST .../computers/{botId}/restore (restoreComputer): restore the computer from one copy. Answered at once (202) with the restore running; the read above says how it ends. One restore per computer at a time (409 COMPUTER_RESTORE_RUNNING).

Why this shape

  • Never automatic. A restore happens only when a person asks, and the computer as it is now is saved first, so a restore can always be undone. Restoring from an old copy without asking is how recent work gets lost.
  • Who may restore. An administrator of the organization, or the person whose computer it is when they own the Bot (an isolated Bot's computer is its owner's). An administrator may name another person's computer with computer; nobody else can reach another person's.
  • Bots wait, not fail. A Bot's action while its computer is being restored is answered 503 COMPUTER_RESTORING, which is retryable.

Checks

  • bun run api:generate (bundle and clients regenerated), bun run api:lint clean, bun test api passes.
  • Additive only: no existing operation or schema changes.

The screens come in their own pull request.

Two operations on the computer a Bot runs on:

- getWorkspaceSnapshots: the computer's saved copies of its files and browser sign-ins, newest
  first (one a day, the last 7 kept, and one saved just before each restore), the latest restore
  and how it ended, and whether the caller may restore it.
- restoreComputer: put the computer back the way it was in one copy. Only when someone asks:
  OpenBot saves the computer as it is now first, then replaces its files and sign-ins and starts it
  again. Answered at once with the restore running (202). One restore of a computer at a time
  (409 COMPUTER_RESTORE_RUNNING).

An administrator of the organization may name another person's computer; otherwise it is the
caller's own. A Bot's action while its computer is being restored is answered 503
COMPUTER_RESTORING, worth retrying.
@davidmckayv
davidmckayv force-pushed the api/workspace-snapshots branch from a1fc568 to 49f4fc9 Compare November 22, 2026 10:11
@davidmckayv
davidmckayv merged commit c8b5843 into main Nov 22, 2026
33 checks passed
@davidmckayv
davidmckayv deleted the api/workspace-snapshots branch November 22, 2026 10:16
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