DEV Community

Sandscale
Sandscale

Posted on Edited on Originally published at sandscale.dev

A Codex workspace that keeps your hours: schedules, time zones and overnight codex exec runs

If you work from Tokyo, Taipei, Seoul or Singapore, most "run your agent in the cloud" guides quietly assume someone else's clock. A workspace autostart schedule is evaluated in a time zone you can name, so you can have a Codex workspace that is running when you sit down, stops after your day, and still lets a long codex exec run finish while you sleep.

This post builds that setup. The Sandscale commands are checked against the help text of CLI 1.3.0 (sandscale help workspace <command>) and the workspaces guide. The Codex side follows OpenAI's non-interactive mode page, read in November 2026. If you have not run Codex in a workspace before, start with running codex exec in a cloud workspace, which covers sandbox modes and output in more detail.

What a workspace is, briefly

A Sandscale workspace is a persistent cloud computer: a Firecracker microVM with its own kernel and a disk that is kept when it stops. Codex, your clone and Codex's sign-in live on that disk, so you set them up once. Commands Codex runs land on the workspace, not on your laptop.

One thing to be clear about up front: Sandscale runs in its United States region (us-east) today. The time zone below only changes when the schedule fires. It does not move the machine.

1. Create the workspace

curl -fsSL https://sandscale.dev/install | sh
sandscale login
sandscale workspace templates-list
sandscale workspace create --name codex-box --template-id TEMPLATE_ID --yes
sandscale workspace ssh codex-box
Enter fullscreen mode Exit fullscreen mode

TEMPLATE_ID is an id that templates-list prints; create starts the workspace and ssh connects once it is running, and sandscale workspace list shows the workspace id you need below. Inside the workspace, install Codex the way OpenAI's docs describe, sign in, and clone your repository. Codex calls OpenAI's API, so the workspace needs network access; network follows your plan and your organization's policy, so check that yours allows it.

If you are signing in from a machine without a browser, sandscale login --device gives you a code to enter on another device.

2. Start it with your workday

The autostart schedule is a cron expression (minute, hour, day of month, month, weekday), and it is evaluated in a time zone. --autostart takes a schedule that names an IANA zone, and the older --autostart-schedule takes a cron expression with an optional CRON_TZ= prefix. If no zone is named, the schedule runs in the owner's profile zone, and in UTC when there is none, which is easy to get wrong. Say it explicitly:

# 09:00 on weekdays, Tokyo time
sandscale workspace update --ws-id WORKSPACE_ID --autostart-schedule "CRON_TZ=Asia/Tokyo 0 9 * * 1-5" --yes
Enter fullscreen mode Exit fullscreen mode

The same line for other cities is only a different zone name, for example Asia/Taipei, Asia/Seoul, Asia/Singapore or Asia/Hong_Kong. These are standard IANA zone names. You can also pass the schedule to create.

Then decide how it stops:

sandscale workspace update --ws-id WORKSPACE_ID --ttl-seconds 36000 --idle-timeout-seconds 3600 --yes
Enter fullscreen mode Exit fullscreen mode

--ttl-seconds is the longest the workspace may run after each start (here 10 hours), and --idle-timeout-seconds stops it after that much idle time (here an hour; at least 300). Your organization's lifecycle policy can clamp what you set, and sandscale workspace get --ws-id WORKSPACE_ID shows the workspace as it is now. Check it once after setting, rather than assuming your numbers won.

3. Put Codex's config in your dotfiles

The workspace disk persists, so a clean place for ~/.codex/config.toml, your shell setup and a tmux.conf is a dotfiles repository that you clone on the workspace once and install from. (The docs also describe a dotfiles setting that applies a repository to workspaces for you; CLI 1.3.0 has no command for it, so this post does not show one.)

Use an https://, ssh:// or git@host:path URL with no user name, password or token in it, and keep the repository to config only, never API keys or Codex's stored credentials. Sign in to Codex on the workspace itself; the disk keeps that sign-in.

4. Leave a run going overnight

The pattern: start codex exec inside tmux on the workspace near the end of your day, detach, and read the result in the morning. From your laptop:

sandscale workspace ssh codex-box -- 'tmux new-session -d -s nightly "cd ~/src/my-service && codex exec --sandbox workspace-write --json \"upgrade the test dependencies, run the suite, and fix what breaks\" > ~/nightly.jsonl 2> ~/nightly.err"'
Enter fullscreen mode Exit fullscreen mode

A few things in that line are worth knowing:

  • sandscale workspace ssh NAME -- COMMAND runs the words after -- on the workspace and, as with ssh, joins them with spaces, so quote the remote command as one string.
  • tmux new-session -d starts the session detached, so the run does not depend on your SSH connection.
  • --sandbox workspace-write lets Codex edit files in the working directory. By OpenAI's docs the default for codex exec is read-only.
  • --json makes standard output a JSON Lines stream of events (thread.started, turn.completed, turn.failed, item.* and so on). Progress goes to standard error, which here goes to its own file.

Your stop schedule still applies. If the run might go past it, either start it earlier, raise --ttl-seconds for that day (0 uses your organization's maximum), and set it back afterwards. A run that is cut off by a stop leaves its partial work on the disk, because stopping keeps the disk, but Codex itself will not continue on its own after the workspace starts again.

5. Read the result in the morning

When the schedule starts the workspace, check how the run ended without opening a full session:

sandscale workspace ssh codex-box -- 'grep -E "turn.(completed|failed)" ~/nightly.jsonl | tail -n 3'
sandscale workspace ssh codex-box -- 'cd ~/src/my-service && git status --short && git diff --stat'
Enter fullscreen mode Exit fullscreen mode

Then connect to the workspace and review the diff properly before you push anything:

sandscale workspace ssh codex-box
Enter fullscreen mode Exit fullscreen mode

For the browser, open the workspace from the console. Editors that connect over SSH can use the host block that sandscale workspace ssh-config prints.

6. Checking the connection from where you are

You are connecting to a US region from Asia, so it is worth looking at the connection once rather than guessing. CLI 1.3.0 has no ping command for workspaces, but you can time a trivial command, which includes the connection setup:

time sandscale workspace ssh codex-box -- true
Enter fullscreen mode Exit fullscreen mode

What you see depends on your network and where you are. Interactive typing over SSH is where distance shows most; overnight codex exec runs, where nobody is typing, are where it matters least, which is one reason the overnight pattern above suits a workspace far from you.

Things that catch people out

  • The schedule's zone is not the workspace's clock. The workspace's own system clock zone comes from its template, not from the schedule. Check it with date on the workspace, and if your scripts print times, set TZ in your dotfiles.
  • A stopped workspace is still there. Stopping keeps the disk; sandscale workspace delete --ws-id WORKSPACE_ID deletes the workspace and its disk for good.
  • Codex's sandbox and the workspace are separate layers. Codex's --sandbox mode limits what Codex may do on its host. The workspace is the host, its own microVM, so even a run with broad access lands on the workspace's disk and not on your laptop.

FAQ

Can a Sandscale workspace start on a schedule in my local time zone?

Yes. sandscale workspace update --ws-id ID --autostart-schedule "CRON_TZ=ZONE CRON" takes a five-field cron expression and an IANA zone name such as Asia/Tokyo. If no zone is named, the schedule runs in the owner's profile zone, and in UTC when there is none.

Does the time zone change where the workspace runs?

No. It only changes when the schedule fires. Sandscale runs in its United States region today.

How do I keep a codex exec run going after I disconnect?

Start it inside tmux on the workspace, for example with sandscale workspace ssh NAME -- 'tmux new-session -d -s nightly "codex exec ..."', and keep --ttl-seconds long enough for the run.

Related

Originally published on the Sandscale blog.

Top comments (0)