Windows: terminal daemon dies after closing a workspace, killing all PTY sessions (+ terminal-history files are all 1 byte)
Summary
On Windows, orca-terminal-daemon.exe dies ~25 seconds after closing a workspace, taking all local PTY sessions down with it. Orca silently respawns the daemon and puts a fresh PowerShell in every workspace, so from the user's perspective all working sessions (including running coding agents) suddenly "go dead" and get replaced by new empty terminals. Happened 2× in one morning, reproducibly correlated with workspace closes.
Additionally, terminal scrollback persistence appears broken on Windows: every file in %APPDATA%\Orca\terminal-history is exactly 1 byte, so nothing can be restored after the daemon restart. When switching workspaces, the renderer briefly flashes its cached copy of the dead session's buffer before swapping in the fresh shell — which makes the data loss look like a visual glitch.
Environment
- Orca 1.4.131 (installed build,
daemon-host\1.4.131) - Windows 11 Home 10.0.26200
- Multiple local git workspaces open, plus one SSH workspace (the SSH workspace's terminals were unaffected, as expected since its PTYs live remotely)
Evidence (%APPDATA%\Orca\logs\daemon.log)
Three daemon startup events in one morning (2026-07-10, times UTC). The 2nd and 3rd each follow ~25s after a workspace close issued a graceful-then-forced session-killed for that workspace's session:
# restart 2 — right after closing a workspace ("ruffe")
{"ts":"2026-07-10T06:30:03.504Z","pid":17604,"event":"session-killed","sessionId":"...::C:/Users/<user>/orca/workspaces/BestEx/ruffe@@260408bb","immediate":false}
{"ts":"2026-07-10T06:30:03.510Z","pid":17604,"event":"session-killed","sessionId":"...::C:/Users/<user>/orca/workspaces/BestEx/ruffe@@260408bb","immediate":true}
{"ts":"2026-07-10T06:30:26.232Z","pid":34920,"event":"startup","protocolVersion":18,...} <-- daemon died, new pid
# restart 3 — right after closing another workspace (a herdr-managed worktree)
{"ts":"2026-07-10T07:41:57.607Z","pid":34920,"event":"session-killed","sessionId":"...::C:/Users/<user>/.herdr/worktrees/Ai-economics/worktree-clear-valley-56ba@@88e3d732","immediate":false}
{"ts":"2026-07-10T07:41:57.613Z","pid":34920,"event":"session-killed","sessionId":"...(same)...","immediate":true}
{"ts":"2026-07-10T07:42:23.643Z","pid":10508,"event":"startup","protocolVersion":18,...} <-- daemon died again, new pid
After each startup, session-created events show fresh shells being spawned for every open workspace. There is no shutdown/error event in the daemon log before the death, and there are no Windows Error Reporting / Application event log entries for the process — it exits silently.
Notable detail: a session-kill that used only immediate:true (no graceful attempt first, at 06:07:18Z) did not take the daemon down. Both fatal cases follow the immediate:false → immediate:true (graceful-then-force) pattern, which suggests the crash is in the graceful-kill/timeout path.
A running Claude Code agent session (~7.7 MB conversation) was killed mid-session by restart 3; its terminal was replaced by an empty PowerShell.
Second issue: terminal-history files are all 1 byte
Every file under %APPDATA%\Orca\terminal-history\ is exactly 1 byte (and read-locked via ACL from the user's own account), regardless of how much scrollback the session had. So after a daemon restart there is nothing to restore, and the only trace of the old session is the renderer's transient cached buffer (the "flicker"). If history persistence worked, the daemon crash would be far less destructive.
Expected
- Closing one workspace never kills PTYs belonging to other workspaces.
- If the daemon does die, scrollback should be restorable from terminal-history.
Actual
- Closing a workspace kills the daemon → all local sessions die and are silently replaced with fresh shells.
- terminal-history persistence writes 1-byte files, so nothing is restorable.
Happy to provide the full daemon.log, main.trace.ndjson, or run a debug build to help pin this down.