Repository navigation
feat(daemon): pause automatic restores after a same-boot crash - #27433
Merged
Merged
Conversation
8 tasks done
OrcaWin
force-pushed
the
np/d1-spawn-gate-enforce
branch
from
October 11, 2026 09:35
a92fcb5 to
f91e598
Compare
OrcaWin
force-pushed
the
np/d1-crash-pause
branch
from
October 11, 2026 09:35
a8b2b8c to
8a72785
Compare
added 2 commits
October 11, 2026 03:01
…in retirement, no Windows boot-time guess
OrcaWin
force-pushed
the
np/d1-crash-pause
branch
from
October 11, 2026 10:01
8a72785 to
0706f29
Compare
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
If the terminal host crashes while it is restarting agents, restarting them all again straight away can crash it again. This happens while the machine itself is still up: the daemon was killed or ran out of memory. With this PR the host remembers that it died in the middle of automatic restores. After such a crash it stops restarting agents on its own until someone resumes them. Panes the user opens still start, and so do requests from current clients. A real reboot does not pause anything. After a reboot, restores go through the normal pacing.
What Changed
Stacked on #27428. Review only the top commit.
automatic-work-run.json, in its runtime directory. The marker records:boot_id; on macOS, boot time derived from uptime, compared with a 2-minute tolerance. On Windows the boot is recorded as unknown, because Fast Startup keeps the uptime counter across a shutdown. A Windows daemon therefore never pauses until a reliable boot signal exists.running(written durably, before the first automatic fork of the run) orclean-exit(written after an orderly shutdown has disposed every session);runningin the same boot, the new daemon starts with automatic workpaused(unclean_host_death) and logsautomatic-work-paused. A pause already on record is kept until an explicit resume. A new boot is never paused.terminal_spawn_deferred:paused).Mechanism details:
daemon-v<N>.automatic-work-run.json, next to the PID record). An old-protocol daemon kept alive beside a new one can therefore never read the other's run as a crash.DaemonServer.start). A daemon that later loses its endpoint stops writing, so it never rewrites its successor's record.runningwrite could otherwise land after theclean-exitwrite and fake a crash.Why
This implements the owner's decision on #10493 Q2: pause durably after an unclean death, but only when the same boot continued. A new boot without a clean exit goes through the normal budget, because Windows ends a detached, console-less daemon at reboot without any shutdown event. A "clean exit at shutdown" rule would therefore have paused every Windows reboot.
orca serve, and orcad on SSH hosts alike.Linked Issue
Refs #10493
Visual Proof
N/A: no UI change and no behavior change until a client declares intent. The only visible output is the
automatic-work-pauseddaemon log line.Testing
automatic-work-run-marker.test.ts: covers the following.runningin the same boot.automatic-work-run-marker-store.test.ts: covers the following.terminal-spawn-gate.test.ts: covers the following.pnpm tc,pnpm lint,pnpm run check:code-quality:changedand the daemon suites pass.Review
Agent skill upstream boundary
Notes
exited. It only decides whether automatic work may start.Checklist
N/Afor visuals with reasonpnpm lint,pnpm typecheck, and focused tests pass locally; CI covers the rest