Product · Jun 18, 2026 · 10 min read
The night shift: agents that fix bugs while you sleep
Shipping isn’t the end. The first 5xx in production usually arrives at the worst possible time, and the gap between “something broke” and “someone fixed it” is where trust leaks. For a solo builder, that gap can be eight hours of sleep.
The night shift is an opt-in agent that closes that gap. Every app Moonshift builds carries a small error beacon. When the agent sees a real, localizable code bug clear its confidence gate, it goes to work, without waking you up.
How the beacon works
Every generated app ships with a tiny client and server error beacon, injected by an always-on codemod at build time. It reports unhandled errors and 5xx responses, with enough context to localize them, and nothing more. No user data, no payloads, just the shape of the failure.
When a report comes in, the agent first asks one question: is this a code bug I can actually fix? A failing third-party API, a missing environment variable, or a misconfigured DNS record are real problems, but they don’t live in your code. Those become notifications, not patches.
Reproduce, test, patch, propose
For a real code bug, the agent reproduces the error on a clone of your repo, writes a regression test that captures it, and makes the smallest patch that turns the test green. Then it opens a draft pull request against your GitHub, with the error, the repro, and the diff laid out.
The order matters. A test that fails first proves the bug is real and reproducible; a patch that makes it pass proves the fix actually addresses it. You’re reviewing evidence, not a hopeful guess. A diff with a green test next to it is a very different thing from “the AI thinks this might help.”
- A regression test that reproduces the exact failure.
- The minimal diff that turns it green, nothing else touched.
- The original stack trace and the inputs that triggered it.
- A draft PR you can read in two minutes and merge in one click.
It never touches the live app and it never auto-merges. A Night Shift tab on the project lists detections and links each draft PR, with a Merge and redeploy button when you’re ready. You stay the human in the loop.
The confidence gate
The gate is deliberately conservative. If the agent can’t cleanly localize a bug to a code change it’s sure about, it notifies instead of guessing. A wrong fix that ships silently is worse than no fix at all, it erodes the exact trust the feature is supposed to build.
Conservative also means quiet. The night shift is not a notification firehose. It speaks up when it has a fix worth reviewing, and otherwise stays out of your inbox.
Safe by construction
Fingerprint dedup means one bug makes one PR, not ten. If the same error fires a thousand times, you get a single draft, not a thousand. A concurrency cap and a per-run spend cap keep the whole thing bounded, so an opt-in convenience can never become a runaway cost.
Opt-in, allowlisted, deduped, capped, and never auto-merged. The design goal was a feature you could turn on for a real project and forget about, not one you’d have to babysit.
“You close the laptop. The project keeps moving.”