mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 08:02:28 +00:00
* fix(pty): stop daemon reattach/kill race from orphaning restored terminals Two cold-start defects let a PTY kill silently orphan a live daemon session after a renderer/app restart — the PTY-orphaning-on-restart half of #7742: - DaemonPtyAdapter.shutdown() was the only session op that skipped ensureConnected(). The daemon client connects lazily, so a kill arriving before the first spawn (startup sleep/hibernation sweeps, closing a restored tab) threw "DaemonProtocolError: Not connected" against a HEALTHY daemon; the renderer swallows the rejection and the live session survives detached. Fix: connect first, like every other session op. - pty:kill had no startup barrier while pty:spawn did. A kill issued before initDaemonPtyProvider swapped the provider resolved against the pre-daemon LocalPtyProvider, whose shutdown() silently no-ops on daemon ids; the handler then reported success and sent a synthetic pty:exit, permanently clearing the persisted tab->ptyId binding so the session never reattaches. Fix: pty:kill awaits the same getLocalPtyStartupPromise gate as spawn. Both reproduced red-first (real DaemonServer socket rig for the adapter; deferred-barrier IPC rig for the handler) and pass after the fix. Scope: this restores the reattach/teardown invariant. It does NOT address the renderer crash trigger or the daemon-process-death path that produces the Windows PowerShell FailFast symptom (separate follow-ups). * fix(pty): gate runtime shutdown on daemon startup * fix(pty): keep shutdown independent of hook startup