mirror of
https://github.com/stablyai/orca.git
synced 2026-10-20 08:03:28 +00:00
Daemons accumulated ptmx fds over time because node-pty's UnixTerminal only releases the master fd when destroy() runs. On the natural-exit path (the common case — user closes a tab, shell runs `exit`) nothing ever calls destroy(), so the fd leaks until GC. On macOS this eventually hits kern.tty.ptmx_max=511 and all new terminals fail to spawn. Fix: release the fd synchronously on every teardown path (natural exit, explicit kill, stale SSH spawn, daemon shutdown) and close the concurrent SIGHUP-to-recycled-pid hazard inside node-pty's UnixTerminal.destroy(). - src/main/daemon/pty-subprocess.ts: synchronous POSIX proc.kill neutralization inside proc.onExit; dead guards on forceKill/signal so they never target a reaped-and-possibly-recycled pid - src/main/daemon/session.ts: new disposeSubprocess() for already- exited sessions (fd release only, no SIGKILL) — avoids sending SIGKILL to a recycled pid during daemon shutdown - src/main/daemon/terminal-host.ts: dispose loop routes on isAlive — live sessions get forceKillAndDisposeSubprocess (SIGKILL + fd release), exited sessions get disposeSubprocess (fd release only) - src/main/providers/local-pty-provider.ts: same POSIX kill neutralization at top of onExit for the legacy local path - src/relay/pty-handler.ts: same neutralization in wireAndStore; disposed flag guards all public entry points; dispose() uses SIGKILL (not SIGTERM) before destroy since the relay is exiting; killTimer fallback + immediate-shutdown + stale-spawn cleanup all call disposeManagedPty + ptys.delete so wedged children (D-state, bad NFS) can't leak map entries against the 50-PTY cap Windows is exempt everywhere — WindowsTerminal.destroy IS a kill() call internally (closes the ConPTY agent), so neutralizing would turn destroy into a no-op and leak the agent. See docs/fix-pty-fd-leak.md for the full design. Co-authored-by: Orca <help@stably.ai>
Orca CLI Docs
Keep this folder focused on the durable references for Orca's public CLI and runtime model.
Keep These Docs
orca-cli-focused-v1-status.md- What is actually implemented and intentionally in scope now.
orca-cli-v1-spec.md- The public CLI contract, selector grammar, JSON envelope, and command semantics.
orca-runtime-layer-design.md- Why the runtime layer exists and which boundaries it owns.
orca-cli-bundled-distribution.md- How the bundled desktop-app distribution and PATH registration model works.
Why The Folder Is Small
Earlier design and implementation work produced several planning and evaluation docs. Those were useful while the feature was taking shape, but they were intentionally removed once the implementation converged so future readers are not forced to choose between multiple overlapping sources of truth.