Reference / Sleep and wake

Sleep and wake

When a Rootsy computer sleeps, what wakes it, what survives, how to keep it awake for a long job, and when the workspace pauses.

Updated 2026-10-21 · View as Markdown

This page covers when a Rootsy computer sleeps, what wakes it, what happens to running work, how to keep it awake for a long job, and when the workspace pauses. A computer sleeps when nothing holds it awake and wakes when something needs it. Every app and job on it has to cope with that.

When a computer sleeps

Assume a computer can go to sleep as soon as nothing holds it awake. These hold it awake:

  • An open connection to the computer. That includes the workspace with its Terminal or Editor connected, and a visitor’s request that is still being answered.
  • Claude Code while it’s working, under the rules in the next section.
  • A command run with rootsy keep-awake -- <command>, for as long as the command runs.
  • A command started through MCP run_command, until it finishes or reaches its timeout (at most 900 seconds). See Connect with MCP.
  • Rootsy restoring a backup or checking one after it’s made.

Everything else lets it sleep. A dev server or file watcher left running in the background doesn’t hold it. Neither do cron jobs or timers inside the computer. A script that requests your own address on a timer stops as soon as the computer sleeps. A computer serving occasional requests sleeps and wakes between them.

How Claude Code holds the computer awake

The claude command on a computer is a wrapper that holds the computer awake while Claude Code has work in progress:

  • During a turn, Claude Code holds the computer awake. A turn that goes 30 minutes without tool activity stops holding, unless something it started is using CPU. A turn you interrupted, or one waiting on a question you haven’t answered, ends up here.
  • After a turn ends, background tasks Claude Code started hold the computer only while they use CPU. A compiling build holds. An idle dev server doesn’t.
  • While Claude Code waits for you to approve a permission prompt, the computer stays awake only if something it started is using CPU.
  • While a terminal is attached to the tmux session Claude Code runs in, the hold stays on.

The CPU check counts only Claude Code’s own process tree. A build inside a Docker container runs outside that tree. A job that spends its time waiting on the network uses little CPU. The computer can sleep in the middle of either. Work you leave running after you exit Claude Code isn’t covered. Run such work under rootsy keep-awake.

What wakes it

  • An HTTP request to the computer’s address or a custom domain, including the requests a schedule sends.
  • Opening the computer’s workspace.
  • A command, a file import or export, or a restart sent through MCP.
  • Rootsy checking the daily automatic backup, on a computer that has been in use since the last one.

A request doesn’t wake a computer that’s parked because the account is out of Runtime Credits, or dormant because the plan has fewer computers than the account holds. Visitors get a 503 page instead. See Troubleshooting and Billing.

A visitor’s GET or HEAD request waits up to 15 seconds for your app’s response headers, wake included. After that the visitor sees “This website isn’t responding”. See Troubleshooting.

Nothing inside the computer can wake it. Cron, systemd timers and setTimeout don’t run while it sleeps. To run something at a set time, create a schedule. Rootsy sends a request to an endpoint on your computer, and the request wakes it. See Scheduled tasks.

What happens to running work

When a computer sleeps, its processes can be frozen or stopped. When it wakes, a frozen process can resume where it was, or the computer can start fresh from its disk. You can’t choose which, so write every app and job to survive a restart.

Open TCP connections are cut either way, in both directions. That includes visitors’ event streams, connections to outside databases and APIs, and downloads in progress. Code that holds a long connection needs to reconnect when it fails.

A process that resumes sees the clock jump forward. A timer that was due during the sleep fires late or not at all.

When the computer starts fresh, only what starts at boot runs again: Rootsy’s platform services, your nginx, the terminal’s tmux session with the rootsy welcome guide, and any systemd services you enabled. Processes you started by hand, a running Claude Code session and anything held only in memory are gone. The disk is intact.

Plan for the restart:

  • Keep state on disk. Sessions, carts and queues go in a file or SQLite under ~. Express’s default MemoryStore loses every login on a restart. Give it a file or SQLite store.
  • Run an app that must come back as an enabled systemd service. See Serve an app.

Commit work in progress to git regularly.

Keep the computer awake for a job

Run the job under rootsy keep-awake from a terminal on the computer:

rootsy keep-awake -- npm run build

The hold lasts exactly as long as the command runs, whether or not it’s using CPU. While it runs, rootsy status shows a line such as wake-hold: active — keep-awake: npm run build.

rootsy keep-awake exits with the command’s exit code, so rootsy keep-awake -- make && ./deploy.sh only deploys after a successful build. The command runs with no terminal input, so it can’t prompt for anything. Jobs covers long-running work in more detail.

Workspace idle pause

The workspace in your browser pauses itself after 15 minutes without keyboard, pointer, scroll or touch input in that tab. Output appearing in the terminal doesn’t count as input. Neither does switching to the tab.

When it pauses, the workspace shows “Preserving your workspace…” while it backs up the Editor’s unsaved changes. Then the Terminal, Editor, Files and Preview windows disconnect, and the workspace shows “Workspace paused while you were away”. A workspace tab that loads in the background starts paused.

Move the pointer, press a key or choose Reconnect to reconnect. If the connection doesn’t come back within 30 seconds, the workspace shows “Couldn’t reconnect” with a Try again button. Uploads and downloads already in progress keep going while the workspace is paused.

Pausing the workspace doesn’t stop anything on the computer. Claude Code in the middle of a turn keeps working and keeps the computer awake by itself. If nothing else holds it, the computer can sleep once the workspace has disconnected.

What sleep and wake cost

Time awake spends Runtime Credits. Time asleep doesn’t. A rootsy keep-awake hold spends them for as long as the command runs, and so does leaving the workspace connected. Awake time while Rootsy makes, checks or restores a backup, or resets the computer, isn’t charged to you. Rates and allowances are on Billing.