Skip to content

CLI reports "Orca is not running" when the caller lacks permission to probe it: EPERM from process.kill and the runtime socket is collapsed into absence #19604

Closed

Description

@TheAbyss

Summary

The orca CLI reports "Orca is not running" when the truth is "this caller is not permitted to look." A sandboxed caller — e.g. a Codex TUI session launched in workspace-write mode — gets EPERM on both the PID liveness probe and the runtime socket, and the CLI turns that into a confident, wrong claim that the app is down, together with advice to restart it.

Unrelated to #19589 in mechanism, though we hit both in the same incident.

Root cause 1 — src/cli/runtime/status.ts

function isProcessRunning(pid) {
  try {
    process.kill(pid, 0)
    return true
  } catch {
    return false        // <-- every failure becomes "not running"
  }
}

process.kill(pid, 0) fails for two unrelated reasons:

  • ESRCH — no such process. The app really is gone.
  • EPERM / EACCES — the process exists, the caller may not signal it.

The bare catch collapses them, so a permission denial is indistinguishable from absence. That false then feeds app.running: false and the stale_bootstrap path.

Root cause 2 — src/cli/runtime/transport.ts

socket.once('error', () => {
  ...
  error: new RuntimeClientError(
    'runtime_unavailable',
    'Could not connect to the running Orca app. Restart Orca and try again.'
  )
})

The socket error is discarded entirely — the handler takes no argument. An EPERM on the AF_UNIX socket produces the same message as a genuinely absent app, plus a restart recommendation that cannot help and is actively harmful: restarting Orca to "fix" a permission denial would kill every running terminal.

src/cli/runtime/cli-error.ts compounds it by appending "Orca is not running" to runtime_unavailable, and the metadata readers similarly hide denied reads.

Reproduction

  1. Launch a Codex TUI session in Orca with sandbox mode workspace-write (not full access).
  2. From inside that session, run orca status --json.
  3. Observe app.running: false / stale_bootstrap, and the guidance to restart Orca.
  4. From an unrestricted session on the same machine at the same moment, run the same command: the runtime is reported healthy.

Both sessions read identical runtime metadata. The difference is only that in (2) process.kill(pid, 0) and the socket connect() both return EPERM.

We reproduced the differential with an Electron-free Python probe, so this is not an artifact of the Electron codesign warning.

Why this cost us real work

Eight of our agent panes across four worktrees independently concluded they had no Orca runtime access and stopped, each reporting some variant of "Orca runtime access needs the pending sandbox approval." They were waiting on a human approval that was never actually required — the runtime was up the whole time. They sat idle for hours.

The failure mode is particularly expensive for automation: the CLI does not merely fail, it succeeds with a false negative and recommends a destructive remedy. An agent has no way to tell this apart from a real outage.

Suggested fix

Distinguish the three cases rather than collapsing them:

  • EPERM/EACCES → a distinct "access denied" error naming the operation, never "not running"
  • ESRCH → genuinely absent
  • anything else → explicitly unverifiable, rather than guessing false

We have a working patch with tests in PR #19605 — offered as evidence, not as a contribution we intend to maintain (see that PR for context).

Environment

  • Orca 1.4.194 (com.stablyai.orca); the diagnostic work was based on a278d84a / package.json 1.4.197
  • macOS 15 / Darwin 25.6.0, Apple Silicon
  • Codex CLI 0.153.4, sandbox mode workspace-write

Activity

  1. added theissue type on Sep 19, 2026
  2. Ryannnnnya commented on Sep 21, 2026

    @Ryannnnnya

    Additional reproduction on Orca 1.4.205 (2026-09-21)

    Confirming that this still occurs in the installed 1.4.205 build. Adding evidence here rather than opening a duplicate issue. I see that #20487 is open; I have not applied or tested that patch.

    Environment

    • Orca 1.4.205, packaged macOS application.
    • macOS 27.0 (26A428), Apple Silicon / arm64.
    • Codex command execution with workspace-write sandbox restrictions; control commands run outside that sandbox through command-scoped approval.
    • The same installed CLI and running desktop application were used for both checks. No restart or application modification was performed between the paired checks.

    Reproduction

    1. Leave the Orca desktop application running.
    2. Run orca status --json from the restricted Codex execution environment.
    3. Run the identical command through an approved, non-sandboxed command execution on the same machine.
    4. Compare the results. Both commands exit with code 0.

    Selected fields from the actual responses (unrelated fields and local identifiers omitted):

    {
      "sandboxed": {
        "ok": true,
        "app": { "running": false },
        "runtime": {
          "state": "stale_bootstrap",
          "reachable": false,
          "connectionState": "disconnected"
        },
        "graph": { "state": "not_running" }
      },
      "approved_host_command": {
        "ok": true,
        "app": { "running": true },
        "runtime": {
          "state": "ready",
          "reachable": true,
          "connectionState": "connected",
          "appVersion": "1.4.205"
        },
        "graph": { "state": "ready" }
      }
    }

    Separate read-only Node probes in the sandbox, targeting the live Orca PID and its existing Unix socket, both returned:

    process.kill(pid, 0): EPERM
    net.createConnection(runtimeSocket): EPERM
    

    An earlier orca repo list --json in the sandbox exited 1 with runtime_unavailable and a message recommending a restart. An attempted orca open --json then exited 1 with runtime_open_timeout. Approved host commands subsequently accessed the runtime and project list successfully. The misleading status initially caused our assistant to report that Orca was not running and unnecessarily ask the user to reopen it; the intended task was delayed. We did not observe data loss or claim a crash.

    Installed-code confirmation

    The packaged files under Contents/Resources/app.asar.unpacked/out/ still contain the relevant behavior:

    • cli/runtime/status.js:68-84,97-107: after RPC failure, the PID probe catches every exception as false, which becomes stale_bootstrap / not_running in an ok: true response.
    • cli/runtime/transport.js: the socket error handler discards the underlying error and emits a generic restart suggestion.
    • cli/cli-error.js: human-readable formatting can add an application-not-running suggestion for generic runtime_unavailable. This is a related text-output path, not the source of the successful-but-wrong status --json response above.
    • cli/runtime/metadata.js: read failures are also collapsed into missing/unavailable metadata. Permission-denied metadata reads were not reproduced in this report; this is a code-inspection observation only.

    Expected behavior

    Please preserve the underlying failure category and report denied or unverifiable access without claiming that Orca has exited or recommending a restart. Simply changing the PID probe to return true for EPERM would still allow a misleading permanent starting state, so the status projection needs to retain the access failure as well.

    This report requests accurate diagnostics, not a sandbox bypass. Command-scoped host execution works as a workaround here. Compatibility of any new status/error fields still needs validation. No local patch was installed and no test results for the proposed upstream fixes are claimed.

    Prepared with AI assistance from observed command results and inspection of the installed build. Runtime credentials, socket paths, user/project paths, and private session identifiers are intentionally omitted.

  3. nwparker commented on Sep 27, 2026

    @nwparker
    Contributor

    Closing as fixed by #22341. The CLI now distinguishes a denied runtime connection from an absent app and gives the correct next step without recommending a restart.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions