Skip to content

[Bug]: SSH host: each app update leaves the previous relay and its agent PTYs running, and resumes the same sessions under the new relay #26872

Closed as not planned

Description

@Tamaz-sujashvili

Operating system

macOS 26.6.2 (client, Apple Silicon). SSH host: Ubuntu 26.04.1 LTS x86_64, Node v22.23.3.

Orca version

1.4.223 (relay 0.1.0+0d9e2827fa5f). Also seen on 1.4.222 (relay 0.1.0+239293179b77) and two earlier 1.4.22x builds.

Details

Short summary

Every app update installs a new relay version on the SSH host and starts a new relay.js --detached process. The open agent tabs are resumed under the new relay (claude --resume <id>). The previous relay is never stopped, and neither are its PTYs. The agent processes in those PTYs keep running, with no window attached to them.

Result on the host after a few updates: one relay per installed app version, and the same agent session running two or three times at once.

What I observed

Four relay builds were installed over five days. All four relay.js --detached --grace-time 0 processes were still running, one per ~/.orca-remote/relay-0.1.0+<hash>/ directory.

Updating 1.4.222 → 1.4.223 today, with six Claude tabs open on the host:

  • a new relay started (0.1.0+0d9e2827fa5f);
  • five of the six sessions were started again under it with claude --resume <id>;
  • the five original processes stayed alive under the 1.4.222 relay;
  • one session id was then running three times (relays from 1.4.22x, 1.4.222 and 1.4.223).

The old relays are still contacted. On every reconnect the app attaches to each old relay for about three seconds and leaves again. Trimmed lines from the relay.log files of the current relay and one old relay:

2026-10-09T10:55:39Z  (new relay) Socket client accepted (clients=1, accepted=7)
2026-10-09T10:55:43Z  (old relay) Socket client closed (clients=0)
2026-10-09T10:55:43Z  (old relay) Grace started (socket client closed): timeoutMs=0, branch=configured, ptys=9, clients=0
2026-10-09T11:27:43Z  (old relay) Socket client closed (clients=0)
2026-10-09T11:27:43Z  (old relay) Grace started (socket client closed): timeoutMs=0, branch=configured, ptys=9, clients=0

So the app knows these relays exist and that they hold PTYs (ptys=9), but it neither adopts those PTYs nor ends them. With --grace-time 0 and ptys > 0 the old relay never exits on its own.

Impact

  • Memory. Before cleanup, 14 agent processes sat under two superseded relays and held about 4.1 GB (RSS plus swap). Each one also kept its MCP server children (140–250 MB per session here). The 16 GB host had its 4 GB swap 100% full.
  • Correctness. Two or three live processes share one session id and one transcript file. Any of them that has a scheduled or background task keeps acting, unseen. I did not catch a double action, but nothing prevents one.
  • It is silent. Nothing in the app shows that old relays or their sessions exist.

Steps to reproduce

  1. Add an SSH host. Open a few Claude tabs on it.
  2. Update Orca to a version that ships a new relay build, and reconnect.
  3. On the host run ps -eo pid,etimes,args | grep -E 'relay.js --detached|claude'.
  4. Two relays are running. The sessions from step 1 appear twice: once under the old relay, once under the new one with --resume.

Expected

One of these, when a newer relay takes over a host:

  • adopt the old relay's PTYs instead of resuming the sessions in new ones; or
  • end the old relay's PTYs once their sessions have been resumed elsewhere, then let the old relay exit; or
  • at least show the leftover relays and sessions in the app and offer to stop them.

Workaround

A timer on the host that ends (a) any agent process whose session id also runs under the newest relay, and (b) any relay whose successor has been up for six hours and which has no connected client, together with its PTYs. Transcripts stay on disk, so the sessions can still be resumed.

Activity

  1. AmethystLiang commented on Oct 9, 2026

    @AmethystLiang
    Contributor

    Thanks for reporting. Looking into it

  2. self-assigned this
    on Oct 9, 2026
  3. Tamaz-sujashvili commented on Oct 10, 2026

    @Tamaz-sujashvili
    Author

    Update after 1.4.224 (managed server, #24863). The leak described above no longer reproduces for me. Same client and host as in the report. Times are UTC, 2026-10-10.

    Update 1.4.223 → 1.4.224, with 8 terminals (7 Claude sessions) open on the 1.4.223 relay

    Time Event
    11:36:28 App quits and installs the update. Relay log: Socket client closed, ptys=8
    11:36:54–11:42 App uploads its Node runtime to ~/.orca-remote/runtimes. The app shows "SSH connection is not active" during this time, then connects by itself
    11:42:43 New relay 0.1.0+94bedc44e8f3 starts with ptys=0 and accepts the client
    11:42:48 The old relay accepts a client too, and keeps it. Eight persistence.pty-binding spans with binding.origin=relay_reattach, all Success

    So this time the app reattached the existing PTYs on the old relay instead of starting the sessions again under the new one. No claude --resume copies appeared, and each session id ran once. That is the first of the three options under "Expected".

    Move to the managed server

    Time Event
    about 11:48:50 The 8 PTYs on the old relay end. Host memory for that login session drops from 5.6 GB to 1.0 GB
    11:48:59 Both relays log Grace started … timeoutMs=900000, branch=idle-no-ptys, ptys=0, clients=0
    11:51:26 orcad-active.json: "active": "0.1.0+15ec2904eb00", "activeAppVersion": "1.4.224"
    12:04:03 Both relays log Shutdown: ptys=0, clients=0 and Process exiting with code 0

    After this, no relay.js process is left on the host. The terminals run under the orcad daemon, and no session id runs twice.

    Two notes

    • The move ended the running agent processes; it did not carry them over. All seven were idle here and their transcripts were intact, so resuming them was enough. An agent in the middle of a turn would have been cut off. I cannot say whether the dialog warns about this.
    • Not tested yet: what happens to open terminals when the managed server itself is updated to a new build.

    From my side this issue can be closed for 1.4.224 and later.

  4. OrcaWin commented on Oct 11, 2026

    @OrcaWin
    Collaborator

    Closing as obsolete after the merged SSH relay retirement in #27214 and #27215. This issue concerns the SSH relay PTY lifecycle, recovery, backpressure, or orphan cleanup. #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. Existing relays started by older Orca versions are not automatically stopped by these merges; their terminals must be closed in that older version or ended on the host before conversion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions