The problem: Codex lives and dies with your terminal
The Codex CLI runs as a child of your shell. That gives it three failure modes that have nothing to do with the agent itself:
- Laptop sleep. Lid closes, the OS suspends everything, Codex stops mid-task.
- SSH drop. Running Codex on a remote machine? A dropped connection sends SIGHUP to your shell and Codex dies with it.
- Closed terminal. Quit the app, lose the process.
None of these are Codex bugs. Any interactive CLI has the same constraint: it needs a live terminal on a machine that stays awake.
Worth repeating because it trips people up: tmux on your laptop does not beat laptop sleep. tmux protects against disconnects. It cannot keep a suspended machine computing. The process has to live somewhere that never sleeps. Not sure whether your current setup has one of these gaps? Run it through the agent survival check.
Fix 1: tmux on an always-on machine
If you have a desktop, home server, or VPS that stays up, tmux keeps your Codex session alive across every disconnect:
The session runs on the server, not in your terminal app. Your connection can drop, your laptop can sleep, and Codex keeps working. screen -S codex does the same job if you prefer the older tool (detach with Ctrl+a d, reattach with screen -r codex).
Fix 2: codex exec for headless one-shot runs
Codex has a non-interactive mode built in. codex exec takes a prompt, runs the task without the interactive UI, and exits. Combine it with nohup and the run survives your logout:
Right tool for fire-and-forget jobs. Wrong tool when you want to steer the agent mid-task. For an interactive session you can leave and rejoin, use tmux.
Fix 3: the DIY VPS route
A small VPS costs $5-10/month and runs the Codex CLI fine. The setup:
Detach and walk away. The agent keeps working on the server.
The hidden costs of DIY, stated plainly:
- Setup and auth friction. The ChatGPT login flow on a headless box means shuttling URLs between machines. Budget an hour or two total.
- Maintenance. Node updates, CLI updates, OS patches, disk cleanup. All yours now.
- Security. A public box with your logged-in agent on it. SSH keys only, firewall on. Also yours.
- No interface. SSH is the whole experience. No browser view, no file browser, nothing friendly on a phone.
Fix 4: managed Codex hosting
Hivra runs the official OpenAI Codex CLI on a private virtual machine provisioned for you. Unmodified, straight from upstream. What the product actually ships:
- Your own ChatGPT login. After launch, the box asks you to sign in with your own ChatGPT account. Hivra never sees or stores your OpenAI credentials.
- Browser access to the session. Terminal, files, and skills tabs wrap the standard CLI, so you can check a running task from any device.
- Optional live self-hosted browser. Turn on browser automation and the Codex box gets a real Chrome instance the agent can drive.
- Always-on infrastructure. The VM stays up. No tmux required, though the terminal tab is right there if you want it.
Launch from the Codex agent page. Takes about 5 minutes.
Plan facts: Codex launches on the free tier ($0, one agent, 0.5 vCPU and 1 GB RAM). Free-tier agents sleep after 4 idle days and skip browser automation. For genuinely always-on with browser automation, Pro is $9.99/month. Numbers on the pricing page.
DIY vs managed
| DIY VPS + tmux | Hivra managed | |
|---|---|---|
| Cash cost | $5-10/mo | $0 free tier, $9.99/mo Pro for always-on |
| Setup time | 1-2 hours | ~5 minutes |
| Login | Your ChatGPT account | Your ChatGPT account, entered inside the box |
| Interface | SSH terminal only | Browser: terminal, files, skills |
| Agent browser automation | You install and maintain it | Optional toggle on the Codex box |
| Updates, patching, security | You | Handled |
| Root access to the box | Yes | Managed VM, resize CPU/RAM in the dashboard |
Both routes end in the same place: the official Codex CLI, on your own OpenAI account, running around the clock. The difference is who runs the server.
Pick your route
- One overnight task:
nohup codex exec "..."on any machine that stays awake. - You own an always-on machine: tmux. Free and done in a minute.
- Permanent setup, you like server work: $5-10/month VPS plus tmux.
- Permanent setup, zero server work: deploy Codex on Hivra, sign in with ChatGPT, close your laptop.