Nightshift
Troubleshooting Nightshift
Nightshift records every attempt, gate result and outcome, so almost every question can be answered from status output or the run log.
Last updated: July 25, 2026
Quick answer
Start with nightshift status, which shows what each role last did and why. The durable run log at .nightshift/state.ndjson holds every attempt, gate result and error classification. Run nightshift doctor when something environmental is suspected, such as a missing CLI, no git repository, or an absent connector.
- nightshift status shows the reason a role skipped or failed
- nightshift doctor diagnoses the environment
- .nightshift/state.ndjson is the full run log
- git branch --list 'nightshift/*' finds work that did not merge
On this page
A role keeps skipping
A skip always carries a reason. Run status to see it. The usual causes:
- A missing connector. The reason names the capability and lists what was found. Fix it in your MCP configuration.
- The daily token ceiling was reached. Raise tokens_per_day or wait for the next day.
- A policy rule matched the role's prompt. Reword the prompt or adjust the rule.
- The role is disabled in nightshift.yaml.
nightshift status
error_max_turns
The role ran out of turns before finishing. Reading a file, editing it, running the tests and fixing what broke takes dozens of turns, so a low cap fails work that would otherwise succeed.
roles:engineer:max_turns: 60 # raise it; the default is 40
This is never retried
Retrying with the same cap fails at exactly the same point, so Nightshift classifies turn exhaustion as unretryable rather than spending tokens to fail again.
A gate always fails
Run the command yourself in the project directory. Gates are ordinary shell commands with no special environment, so if it fails for you it will fail for the role.
- Check the command is non-interactive. Anything waiting for input will hit the timeout.
- Check it exits non-zero on failure. Some tools report problems and still exit 0; use expect_stdout for those.
- On Windows, gates run through cmd, so Unix-only commands such as test -f will not work.
- The run log holds the gate's captured output, including the tail where the real error usually is.
Work is missing from my branch
Check for a preserved branch. A merge conflict, a failed gate or a refused commit all leave the work on its own branch rather than discarding it.
git branch --list 'nightshift/*'git log --oneline nightshift/engineer/...
Provider problems
- claude or codex not found on PATH: install the CLI and sign in, then run doctor.
- Not logged in: the run log will say so. This is never retried, since retrying cannot fix it.
- Rate limited: this is retried with exponential backoff. Persistent rate limiting means your cadences are too dense; spread them out.
- Codex refuses to run outside a git repository: either git init the project, or accept that those roles will not run.
Reading the run log
Every line is one JSON record. Records are typed: cycle_start, attempt, gate, cycle_end, skip and shutdown. Attempts carry the provider, session id, exit code, error classification, token usage and, on failure, the raw output.
# Everything that failedgrep '"outcome":"failed"' .nightshift/state.ndjson# Gate results onlygrep '"kind":"gate"' .nightshift/state.ndjson# Readable, if you have jqjq -r 'select(.kind=="cycle_end") | "\(.time) \(.role) \(.outcome) \(.reason)"' \.nightshift/state.ndjson
Frequently asked questions
Nightshift stopped overnight. How do I tell whether it crashed?
A clean interruption writes a shutdown record to the run log. If the last record is a shutdown, it was stopped deliberately. If it ends mid-cycle, it crashed or the machine slept, and simply starting serve again resumes from where it left off.
Can I reset everything?
Delete the .nightshift directory to clear run state, which makes every role treat itself as never having run, so nothing is treated as missed. Delete any leftover nightshift/* branches once you have reviewed them.
Why did a role run twice in one night?
Most likely two windows genuinely passed, for example a two-hourly role during a long cycle. Catch-up coalesces missed windows into one run by default, so duplicates from downtime should not happen. The run log shows the window each cycle belonged to.
Was this page helpful?
Related articles
Nightshift
Verification gates
Gates are shell commands that must pass before a role's work is accepted. How to write them for code, content, research and reports.
Nightshift
Scheduling, catch-up and budgets
How cadences, catch-up after downtime, token ceilings and pacing keep an unattended Nightshift run inside your plan's limits.
Nightshift
Connectors and MCP
How Nightshift roles reach email, social, support inboxes, ads and payments through MCP connectors you configure yourself.