Repository navigation
Description
Operating system
macOS
Orca version
1.4.204 (both machines)
Details
Short summary
Correction (see comment): the GUI trash button is not affected —
runtimeEnvironments:removedoes tear the transport down. This isorca environment rmonly, because the CLI is a separate process that rewrites the store file and never reaches the running app. Root cause and a suggested fix are in that comment.
orca environment rm — and the trash button in Settings → Remote Orca Servers —orca environment rm removes the environment from orca-environments.json, but the running client keeps the live WebSocket to that endpoint and re-establishes it when the connection drops. The removal only takes effect after the client app restarts. Meanwhile orca environment list reads the persisted file, so the removed server is invisible while it is still connected; the only way to see the discrepancy is lsof/netstat on port 6768.
What happened
Two machines, A and B, each running Orca as both client and server. A had two saved environments pointing at B's runtime over two different network paths (a Tailscale address and a WireGuard overlay address). I removed the overlay one on A.
T+0—orca environment rm --environment <name>returnedok: truewith the removed record.orca environment liston A then showed only the Tailscale environment.T+6min— A still had an established outbound connection tows://<overlay-ip>:6768, source portP1.T+10min— B's Orca was restarted for an unrelated reason, forcing both sides to re-establish.- After that, A's connection to the removed endpoint came back with a new source port
P2, numerically adjacent to the source port of the surviving Tailscale connection — i.e. both were opened in the same batch. A new source port means a new connection: the removed environment actively reconnected ~10 minutes after it was deleted from disk.
Control
B's Orca main process started after I had removed the mirror-image environment on B's side. B therefore booted with only one environment in memory, and it opened zero connections over the overlay path. Same build, same topology; the only difference is whether the environment was in memory when it was removed.
The endpoint is not on disk any more
I grepped the whole ~/Library/Application Support/orca tree for the overlay address. The only configuration-shaped hit is profiles/local-default/orca-data.json → .sshTargets[N].host, which belongs to the SSH-targets feature — not a WebSocket endpoint, not port 6768. orca-environments.json contains only the surviving endpoint. So ws://<overlay-ip>:6768 exists nowhere on disk, and the connection can only come from in-process state.
Note for anyone reproducing this: other files in that tree matched the address as well —
terminal-history/*/checkpoint.json,ai-vault/session-parse-cache.json,agent-hooks/last-status.json. Those are recorded terminal scrollback of my own commands, not configuration. Judge a hit by its path inside the JSON, not by the file name.
How can we reproduce it?
- Pair client A to server B's runtime twice, over two addresses that are both reachable. You now have two environments whose
runtimeIdis identical. - On B:
lsof -nP -iTCP:6768shows connections arriving over both paths. - On A:
orca environment rm --environment <the second one>. Confirmorca environment listno longer lists it. lsofagain on B: the connection over the removed path is still established.- Force a reconnect (restart B's Orca, or drop the link). The removed environment comes back with a new source port.
- Restart A's Orca: only now is it actually gone.
Anything else that might help
Why this is worth fixing beyond tidiness:
orca environment listis the supported way to see what is saved, and it disagrees with what is connected. There is no in-app way to notice the difference.- Someone who removes a server to stop it reaching their machine will reasonably believe it stopped.
- It compounds the duplicate-workspace behaviour: after removing the redundant environment nothing visibly changes until a restart, which invites people to keep removing things looking for an effect.
Suggested fix: when an environment is removed, close its transport and drop it from the in-memory reconnect set, so environment list and the live connection agree.
No endpoint credentials or pairing material are included in this report.
Activity
GodCC6 commentedon Sep 16, 2026
Correction to my own report, and a much sharper root cause after reading the source.
What I got wrong: I wrote that this also affects "the trash button in Settings → Remote Orca Servers". That is not true, and I had not tested it. The IPC handler
runtimeEnvironments:removeinsrc/main/ipc/runtime-environment-connectivity-handlers.tsdoes tear the transport down — it callsinvalidateTransport(removed.id)andcloseLegacySelectorTransport(...)right afterremoveEnvironment(...). The GUI path is fine. Sorry for the noise.What the bug actually is:
orca environment rmis CLI-local and never reaches the running app.ENVIRONMENT_HANDLERS['environment rm']insrc/cli/handlers/environment.tsdoes exactly one thing:and
removeEnvironmentinsrc/shared/runtime-environment-store.tsis a pure store rewrite — read the file, filter out the entry, write it back. The CLI is a separate process, so nothing in the running desktop app is notified.Meanwhile the app keeps the connection in a module-level map in
src/main/ipc/runtime-environment-request-connections.ts:sharedControlConnectionsis keyed byenvironmentId, and each entry is aRemoteRuntimeSharedControlConnectionconstructed with thePairingOffercaptured when it was created.isManuallyDisconnected()andisCapabilityPaused(). It never re-reads the environment store, so "this environment no longer exists" is not something the connection can find out.That is exactly what I measured from the outside: the removed environment kept its socket and re-established it with a fresh source port after the peer restarted, while a client process that booted after the removal opened nothing on that path (it never built the connection in the first place).
Suggested fix, reusing what is already there. The connection already has two "should I stay down?" predicates injected at construction. A third one of the same shape — "is this environment still present in the store?" — would let the reconnect path stop on its own, without a file watcher and without a new CLI→app channel. It only needs to be consulted on the reconnect path, which is backoff-scheduled and not hot.
I am working on a PR for this and will link it here.
[-][Bug]: Removing a saved remote server does not close or stop its connection — the client keeps reconnecting until restart[/-][+][Bug]: `orca environment rm` does not stop the connection — the running app keeps reconnecting to the removed environment until restart[/+]GodCC6 commentedon Sep 16, 2026
PR is up: #21048
It takes the second option from the analysis above — the app closes the socket itself rather than only declining to reconnect — because the reported symptom is the connection that is still open right now, and a disconnect might not come for hours.
The mechanism turned out to need no new machinery: every open shared-control socket already runs a 10s liveness heartbeat, which is the only level-triggered hook such a socket has. It now checks whether the environment is still in the store and, when it is gone, hands teardown to the same
invalidateRuntimeEnvironmentTransportthatruntimeEnvironments:removealready uses, so the CLI and GUI removal paths converge. The reconnect scheduler gained a matching guard for the case where a disconnect beats the tick.Measured on macOS: the socket closes 10030 ms after the store is rewritten — one liveness interval.
The same end-to-end test fails on
mainfor the right reason, which is what makes the fix a fix rather than a green test:That run boots a real Electron main process and rewrites the store from a separate process, which is what
orca environment rmis.Two things I deliberately left out of the PR, mentioned here so they are not lost:
RuntimeHostStatusOwner.complete()callsmarkEnvironmentUsed, which throws and skipssettleWaiters(), leaving anyrefresh()waiter hanging until its own timeout. Happy to open a separate issue if that is useful.orca environment rmstill diverges from the GUI path in other ways — it does not clear capability evidence or the manual-disconnect mark, does not retire browser partition storage, and has no equivalent of the GUI's refusal to remove the active server. Also separate.AmethystLiang commentedon Sep 17, 2026
thanks for reporting. looking into it
AmethystLiang commentedon Sep 17, 2026
thanks for reporting. looking into it
fix(remote): stop redialing servers removed outside the app
fix(remote): stop redialing servers removed outside the app
fix(remote): stop redialing servers removed outside the app