Repository navigation
Conversation
The SSH PTY provider retained per-PTY state keyed by ids the remote host supplies, with no ceiling on how many distinct ids it would hold: - Renderer flow-control credit accumulated one state per relay id, and one segment per delivered chunk within each state. - The live PTY roster accumulated one row per app PTY id, including tombstones for exits, so repeated missed exits grew it without bound. - Relay ids and delivery tokens were retained at whatever length arrived. A remote host cycling ids — or a connection that repeatedly misses exit notifications — could grow main-process memory indefinitely. This adds a shared wire-admission check (ids and delivery tokens screened for length in UTF-8 bytes and unsafe characters before anything retains them), plus ceilings on credit states, credit segments per state and in aggregate, roster entries, and aggregate retained id bytes. Bounding flow-control credit is the risky part: silently dropping credit would stall the producer and freeze a terminal rather than crash it. Eviction therefore returns any outstanding credit upstream, so the remote resumes sending. Roster eviction prefers exited entries over live ones, so a live PTY is only displaced when the roster is genuinely full of live sessions. PTY notification routing moves onto the provider's own subscriber, which also screens ids at ingress rather than after mapping them. Tests: verified by mutation. Making eviction drop outstanding credit instead of returning it fails 2 tests; disabling the state cap fails 3; disabling the segment cap fails 1; making roster eviction ignore liveness fails 1; and removing the subscriber's ingress id check fails 4. Full main-process PTY surface (2,765 tests across providers, daemon, and ssh) passes.
87097b4 to
97c07e6
Compare
4f7d675 to
2d70a4a
Compare
|
SSH still works: Orca connects to the host over SSH and routes workspace operations through the managed remote Orca server (orcad). These merges remove the legacy SSH relay, not SSH support. Closing as obsolete after the merged SSH relay retirement in #27214 and #27215. This PR concerns the SSH relay PTY attach, recovery, replay, or lease lifecycle. #27214 removed the desktop relay connection/fallback path; #27215 deleted the SSH relay server, deployment assets, and relay-only tests. SSH hosts now use the managed Orca server (orcad), and unsupported hosts fail explicitly, so this relay-specific work is no longer planned. This closes the proposed relay implementation; it does not claim that any independent local, WSL, or managed-server behavior was fixed. |
Slice 5 of the re-landed OOM work. Stacked on #10837 (slice 4) — review the diff against
oom-slice-4-daemon-admission, notmain.ELI5
When you run terminals over SSH, the app keeps a little bookkeeping note for each one — where it is, how much output it still owes you. The notes were filed under names the remote machine picks. Nothing limited how many names it could invent, so the filing cabinet could grow forever.
Now there's a cap on how many notes are kept, and how long a name is allowed to be. The tricky part: one of those notes is "how much more output am I allowed to send you." Throwing that note away would leave the remote side waiting forever for permission — your terminal would just freeze. So when a note gets evicted, its permission is handed back first.
What this fixes
Two independent growth paths existed: a remote host cycling PTY ids, and a connection that repeatedly missed exit notifications (each miss left a roster tombstone).
The UX risk, and how it's handled
This is the slice where a naive bound would trade a crash for a freeze. Two deliberate design points:
Evicted credit is returned, not dropped. Flow-control credit is the remote's permission to keep sending. Silently discarding it stalls the producer and hangs the terminal.
removeState(..., returnOutstanding: true)acknowledges the outstanding chars upstream before dropping the state.Roster eviction prefers dead entries. The cap scans for an exited entry first and only displaces the oldest live row if all 256 are live — well beyond any real session count.
Proof of no regression
src/main/providers,src/main/daemon, andsrc/main/ssh; node typecheck and lint clean.Mutation-tested
Every cap was deliberately broken to confirm the tests actually catch it:
That last one is worth calling out. PTY notification routing moves onto the provider's own subscriber (screening ids at ingress rather than after mapping them), which leaves the previous routing module with no importers. Its existing hardening test would still pass while asserting against code nothing calls — so the contract was carried onto the live subscriber. An earlier version of that test used only
pty.dataand survived the mutation, becausepty.datais independently screened downstream by the credit layer; it now coverspty.replayandpty.exittoo, which is what makes the mutant fail.User-facing behavior changes
None expected. Every ceiling sits far above real usage, and the two paths where a bound could have degraded UX (frozen terminal, dropped live session) are explicitly designed against and mutation-tested.
Made with Orca 🐋