← All posts

The 3-second disconnect that kills your AI coding run (and how to never see it again)

July 18, 2026 · 5 min read · The xShellz Team

Last night I kicked off a long job with a new AI coding agent. I closed the laptop and went to bed. When I woke up, the process was dead. No output, no intermediate checkpoint, just an empty terminal and a silent crash.

The culprit wasn't a bug. It was my laptop's power management deciding to suspend the network and sleep 3 seconds after the lid went down. That tiny interruption killed a multi-hour run, and with it, a night of progress I had to do over.

We've built an entire local-first toolchain that works beautifully until it doesn't. Editors are fast, dependencies are right there, and the feedback loop is tight. But local-first development has an expiration date the moment your work outlasts a single sitting. The machine is a single point of failure for anything that needs persistence, and we're building more and more tools that demand exactly that.

The fragility of local uptime

Local Linux terminals, even with tmux or screen, are bound to the same physical box. If the laptop sleeps, tmux freezes. If you close the lid and the system suspends, every process that relies on network I/O or wall-clock time is now in limbo. Some may recover when the machine wakes. Many won't.

It's not just sleep. Walk to a coffee shop and your WiFi drops for 15 seconds. The SSH tunnel that piped logs from a build server dies. A database restore that had been running for 40 minutes gets a broken pipe and leaves a half-imported mess. The local environment is inherently interruptible, and there's no way to avoid it as long as the session lives on a battery-powered device.

CI/CD loops suffer the same fate. A script that watches for new commits, rebuilds a container, and runs a test suite is only as reliable as the machine it's on. If you've ever kept a terminal open for days only to find it crashed because the OS decided to reclaim memory or the power adapter wiggled loose, you know the feeling.

What we're actually trying to run

The tools that expose this fragility the most are the ones designed to run autonomously for long periods. Take borg, our AI coding agent. It's built to work through a task, make changes, run tests, iterate, and produce a PR, sometimes over several hours. A single power event resets the whole loop.

Other agents like Claude Code and GitHub Copilot's agent mode follow the same pattern. They're not interactive in the traditional sense; they need a clean, uninterrupted session to execute a plan. Even a simple while-true loop that scrapes logs and sends alerts becomes a toy if the laptop can't stay awake for a weekend.

The problem isn't the software. It's the assumption that the host will never go to sleep, never lose connectivity, and never be moved. Those assumptions are false for every laptop on the planet.

Moving the workspace to a server

A remote shell changes the equation entirely. Instead of running tmux on a MacBook that sleeps when you close the lid, you SSH into a Linux host that never sleeps, start a tmux session there, and run the agent inside it. You detach, close your laptop, go anywhere, and reattach later from any device. The process keeps running.

This isn't about replacing your local editor with a cloud IDE. You can keep VS Code or Neovim on your machine and sync files with rsync or git. The heavy lifting, the autonomous execution, the long-running jobs, all live on a server where uptime is measured in months, not minutes.

You don't need a whole VM. A cheap VPS, a home lab box that stays on, or a managed shell hosting service all give you the same thing: a $HOME directory on a machine that will be awake when you come back. The difference between a local tmux session and one running on a remote host is the difference between hoping your Mac survives the night and knowing it doesn't matter.

What you gain with persistent uptime

Once the shell moves off your laptop, a few things happen that change how you work.

First, AI agents become overnight workers. Start borg at 11 PM, attach a tmux session, and detach. In the morning, reattach and pull the branch it created. You've been asleep while the agent iterated; no human time was spent.

Second, background tasks stop being fragile. A monitor that tails logs and sends alerts can run for weeks. A loop that periodically pulls from a repo and runs a small CI pipeline doesn't die when you reboot your desktop. The shell becomes an always-on presence, much like a serverless function, but with the full flexibility of a Unix environment.

Third, you stop losing state. I used to keep terminals open on my laptop for weeks, afraid that closing them would lose the shell history and the context of an active debugging session. With a persistent remote shell, you just detach and reattach; the state survives reboots of your local machine, OS upgrades, and even hardware swaps.

Finally, tools that rely on persistent connections, like IRC bouncers, work as intended. ZNC running on a remote shell keeps you connected to IRC channels, buffering messages while you're offline. It's a small example, but it shows the pattern: any service that benefits from a constant online presence becomes trivial when your shell is hosted on infrastructure that doesn't sleep.

A concrete example

Here's how I run borg today.

ssh [email protected]
tmux new -s borg
borg run --task 'fix the login timeout bug'
Ctrl-B D  (detach)

I close my laptop. Hours later, from another machine or the same one, I reconnect:

ssh [email protected]
tmux attach -t borg

The agent's output is right there. If it failed, I see the error. If it succeeded, I see the diff. No dead process, no lost work.

You can do the same with a fresh Debian droplet on any cloud provider if you enjoy maintaining it. But if you'd rather just have a shell that stays up without extra work, that's exactly what we built at xShellz: a persistent Linux environment with tmux, ZNC, and the ability to run borg or any long-lived task right out of the box. The point isn't the brand; it's the architectural change. Move the work to something that won't sleep, and your tools will finally deliver on their promise of autonomous coding.