Skip to content

[Bug]: app crashes with main_uncaught_exception when a server removed via orca environment rm sends a response #22771

Closed

Description

@nwparker

What happens

With the Orca app open and connected to a Remote Orca Server, running orca environment rm <name> in a
terminal removes the server from the saved list on disk. The running app is never told. The next message
that arrives from that still-connected server kills the whole app — every window closes at once, with
main_uncaught_exception recorded.

Why

orca environment rm is a purely local edit to the settings file (src/cli/handlers/environment.ts). The
app keeps its live sockets. When a response arrives, the app records "this server was just used" in the
saved list. The lookup now fails and throws Unknown environment: <id>.

That call happens inside a WebSocket message callback with nothing catching it
(src/shared/remote-runtime-subscription-transport.ts registers ws.on('message', ...) which calls
frameRouter.handleFrame directly; the frame router calls the consumer's onResponse unguarded). The throw
reaches the process uncaughtException handler, which re-throws it.

The removal is only the most reproducible trigger. Any failure reading the settings file on that path is
equally fatal: a half-written file, a file the user has been ACL-locked out of, or one over
MAX_RUNTIME_ENVIRONMENT_STORE_FILE_BYTES.

Steps to reproduce

  1. Pair the Orca app with a Remote Orca Server and open something that streams from it (a remote terminal
    or file watch).
  2. In a separate shell, run orca environment rm <that server>.
  3. Let the server send anything.

Expected: the app keeps running. Actual: the main process dies.

Notes

This is distinct from #20995 (the app keeps reconnecting to a removed server until restart), which is about
teardown. This issue is only about the crash that can land before any teardown happens. Split out of #14210
side problem 2; the tailnet timeout that is the main subject of #14210 is unrelated.

Activity

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