Skip to content

fix(cli): classify a permission-denied runtime connect instead of reporting "starting" - #13583

Closed
Flamingpuffins wants to merge 4 commits into
stablyai:mainfrom
Flamingpuffins:fix/cli-runtime-permission-denied-classification
Closed

Flamingpuffins wants to merge 4 commits into
stablyai:mainfrom
Flamingpuffins:fix/cli-runtime-permission-denied-classification

Conversation

@Flamingpuffins

Copy link
Copy Markdown

Addresses Defect 2 only of #13539 (Defect 2 — permission-denied connect is mapped to permanent "starting"). Deliberately not Closes #13539: Defect 1, the named-pipe
DACL that excludes the Codex sandbox principal, is untouched and needs a native
CreateNamedPipeW security descriptor. That issue notes Defect 2 "could land
independently of Defect 1", which is what this PR does.

It also improves the liveness classification relevant to #12528 (the macOS counterpart) via
the liveness-probe change below. Stated deliberately narrowly: that issue shows the pid
probe is permission-limited under sandbox, but I have not reproduced on macOS whether the
socket connect() there also returns EACCES/EPERM, so I am not claiming this resolves
that issue's classification outright.

This does not restore connectivity. Inside the Codex sandbox, orca commands that need
the runtime — orchestration send --type worker_done among them — still cannot connect.
What changes is how the failure is described, and that differs by command:

  • orca status returns runtime.state: permission_denied where it previously returned
    starting, so a caller polling it is no longer told to keep waiting for a state that
    will never arrive.
  • Every other runtime command throws runtime_permission_denied with the endpoint named,
    where it previously threw runtime_unavailable and its "restart Orca" advice. These
    commands never reported starting themselves — they failed with misleading guidance.

Summary

orca status reported runtimeState: starting whenever it could not reach the local
runtime socket and the recorded pid was still visible. A permission problem on the endpoint
— wrong owner, restrictive mode bits, or a named-pipe ACL — lands in exactly that state, so
the CLI advertised progress that could never arrive. starting is indistinguishable from a
runtime that is genuinely still booting, so the correct client behaviour (keep waiting) is
precisely the behaviour that hangs forever.

Three changes:

  1. The errno is preserved. EACCES/EPERM on connect now surfaces as a distinct
    permission_denied runtime state with a message naming the endpoint, instead of being
    collapsed into runtime_unavailable — whose advice, "restart Orca", recreates the
    endpoint with the same permissions.
  2. The liveness probe stops guessing. process.kill(pid, 0) throwing EPERM means the
    process is present but owned by another user; ESRCH means absent. Any other errno is
    still treated conservatively as absent. This is the probe behaviour CLI reports stale_bootstrap for healthy runtime inside Codex sandbox on macOS #12528 describes on
    macOS, where a present-but-inaccessible process was read as gone.
  3. Precedence is explicit. permission_denied requires a live pid. A permission-denied
    connect behind a provably dead pid is a leftover, so the pre-existing stale_bootstrap
    answer keeps precedence.

Screenshots

No visual change — CLI output only.

Testing

  • pnpm typecheck
  • pnpm lint — exits 0. One caveat worth reporting: on Windows the chain first fails at
    verify:skill-bundle-manifest, claiming
    resources/skills/{current-manifest,snapshot-registry,release-mapping}.json are
    stale. This is not caused by this PR — it reproduces on a pristine checkout of
    current main with zero changes. Root cause is line endings: .gitattributes pins
    eol=lf for byte-compared paths such as /resources/plugins/**, but not for
    resources/skills/*.json, so with core.autocrlf=true they are checked out CRLF
    while the generator writes LF and the comparison fails. Converting those three files
    to LF makes the gate pass and the whole chain exit 0, which is the result recorded
    here. The artifacts are deliberately not regenerated in this PR. A one-line
    .gitattributes entry would fix it for Windows contributors; happy to send that
    separately if useful.
  • pnpm test — not a clean signal locally. The full run completes in ~20 min on the
    rebased branch: 48,438 passed, 229 failed across 79 files, 643 skipped. Zero of the
    failures are under src/cli
    , where every behavioural change in this PR lives. They
    are overwhelmingly EPERM: operation not permitted, symlink (Windows requires
    Developer Mode to create symlinks) and spawn /bin/sh ENOENT, clustered in
    src/main/{ipc,git,ssh,ai-vault}, src/relay, and config/scripts. These are
    environmental rather than related to this change, but CI remains the
    supported-environment signal, so I cannot tick this box from here. Targeted evidence
    instead: src/cli — 732 passed, 28 skipped.
  • pnpm build
  • Added or updated high-quality tests that would catch regressions

Tests

New src/cli/runtime/permission-denied-classification.test.ts, six cases. Each was verified
to fail against the unfixed code by reverting the relevant hunk:

Test Without the fix
EACCES → runtime_permission_denied fails: runtime_unavailable
EPERM → runtime_permission_denied fails: runtime_unavailable
status does not report starting on a live pid fails: starting
EPERM liveness probe treated as alive fails: stale_bootstrap
ESRCH liveness probe keeps stale_bootstrap fails: permission_denied
ECONNREFUSED → still runtime_unavailable passes both ways (guards over-classification)

The connect is faked rather than genuinely permission-denied, because that is not
reproducible across platforms — a root CI user bypasses Unix mode bits and Windows guards
named pipes by ACL. Scope caveat: this exercises how Node's errno is classified, not the
OS enforcement that produces it. It does not prove anything about a real named-pipe DACL,
and it is not a test for Defect 1. The fake emits error then close in Node's real order,
pinning the double-settle guard so the close handler cannot overwrite the classified error.

AI Review Report

Reviewed with Claude. Risks checked, and what came of each:

  • Cross-platform (macOS, Linux, Windows): EACCES/EPERM are the codes both Unix
    domain sockets and Windows named pipes raise for a permission-denied transport path;
    libuv's Windows error mapping produces both. No path strings are constructed — the
    endpoint is echoed from existing metadata — so no separator assumptions. No shortcuts,
    labels, shell
    invocation, or Electron-specific surface is touched. The new tests run on all three
    platforms, unlike the existing socket suites in this directory, which are skipIf(win32).
  • Flagged and fixed during review: (a) the liveness probe collapsed EPERM into "dead",
    so on macOS the new branch would have reported permission_denied alongside
    app.running: false and pid: null — incoherent, and the probe behaviour CLI reports stale_bootstrap for healthy runtime inside Codex sandbox on macOS #12528
    describes; (b) the permission branch originally ran before the pid-dependent
    fallback, silently overriding
    stale_bootstrap for a dead pid; (c) several comments claimed more than the code or the
    syscalls support — that the endpoint "answered" (the OS refuses before the runtime sees
    the connection), that EACCES proves the endpoint exists (it can equally mean denied
    path traversal), and that "only ESRCH proves death" (the implementation treats every
    non-EPERM errno as absent). All are corrected, and (a) and (b) now have dedicated
    regression tests.
  • SSH / remote / local: scoped to the local unix/named-pipe transport. The remote
    pairing branch in client.ts returns before this code, and the remote path
    (websocket-transport.ts, remote-runtime-client-error-classification.ts) is untouched —
    its agreement corpus still passes. The new code is deliberately not added to
    RECOVERABLE_CODES: retrying never clears a permission problem.
  • Agents / integrations / git providers: no agent-, integration-, or provider-specific
    behavior involved.
  • Performance: one Set lookup on an already-failing connect. Nothing in a hot path.
  • UI: not applicable, no renderer change. CliRuntimeState has no exhaustive switch or
    i18n mapping — its two consumers (cli/format.ts, ssh-remote-cli-format.ts) interpolate
    the raw string — so the localization gates are unaffected.
  • Wire compatibility: none. CliStatusResult is built client-side from the status.get
    result; the classification derives from a local socket error and never crosses the wire,
    so no host/client capability negotiation is involved.

Security Audit

  • Authorization unchanged. This PR widens no permission and grants no access. It only
    changes how an already-failing connect is described. A caller denied by the OS is still
    denied; metadata.authToken remains the RPC authority and is untouched.
  • Information disclosure: the error message includes the runtime endpoint path, which is
    already present in orca-runtime.json readable by the same principal, and is shown to the
    local user who just tried to open it. No token, credential, payload, or RPC data is added
    to the message. The existing redactOrchestrationCompatibilitySecrets path for structured
    error data is unchanged.
  • Input handling: the only new input is err.code, compared against a fixed two-element
    allowlist. No parsing, no interpolation into a shell or path.
  • Command execution / IPC: no command execution added. process.kill(pid, 0) is a
    signal-0 liveness probe that was already there; the change only reads the errno it throws
    rather than discarding it. No new IPC surface.
  • Dependencies: none added.
  • Follow-up: none outstanding for this change. Defect 1 remains open and is where the
    actual security-relevant decision lives — any DACL work there should grant only duplex
    client rights, and specifically not WRITE_DAC, WRITE_OWNER, or
    FILE_CREATE_PIPE_INSTANCE, per the analysis in [Bug][Windows]: Codex sandbox cannot connect to Orca runtime named pipe (EPERM); status reports starting forever #13539.

Notes

  • Platform-specific: the reported symptom is Windows-only (the sandbox user can see the
    pid, so it yields starting), but the fix is platform-independent. CLI reports stale_bootstrap for healthy runtime inside Codex sandbox on macOS #12528 describes the
    macOS side, where an EPERM liveness probe yields stale_bootstrap; change 2 above makes
    that probe accurate, but I have not reproduced that issue on this branch and am not
    claiming it resolves it.
  • Behavior change beyond the bug: treating an EPERM liveness probe as alive also
    affects the pre-existing non-permission fallback — a runtime owned by another user that is
    unreachable for some other reason now reports starting rather than stale_bootstrap.
    That is the more accurate answer, but it is a visible change outside the permission path
    and worth a maintainer's eye.
  • Follow-up not included: RuntimeClient.openOrca() polls getCliStatus() for up to
    15s and then reports runtime_open_timeout. A permission_denied endpoint could now bail
    out of that loop early with a useful message. Left out to keep this PR to a single topic;
    behavior there is unchanged by this patch.
  • Unrelated finding: resources/skills/*.json are byte-compared by
    verify:skill-bundle-manifest but have no eol=lf rule in .gitattributes, so
    pnpm lint fails for any Windows contributor with core.autocrlf=true. Not touched here.
  • Rebased onto main (a63df9179) before submitting.

X: @Flamingpuffins

Flamingpuffins and others added 3 commits August 10, 2026 04:52
…ting starting

`orca status` reported `runtimeState: starting` whenever the local runtime
socket was unreachable and the recorded pid was still alive. A guarded
endpoint - wrong owner, restrictive mode bits, or a named-pipe ACL - lands in
exactly that state, so the CLI advertised progress that could never arrive.

Two losses of information stacked. The socket error handler in transport.ts
took no error parameter at all, discarding err.code and collapsing every
connect failure into runtime_unavailable, whose advice is to restart Orca.
status.ts then used a bare catch, leaving nothing to branch on before the
starting/stale_bootstrap fallback.

EACCES/EPERM now surface as a distinct permission_denied runtime state with a
message naming the endpoint. graph.state reports unavailable rather than
not_running, since a live pid disproves that the graph stopped.

Tests fake the connect rather than creating a genuinely permission-denied
socket, which is not reproducible across platforms: a root CI user bypasses
Unix mode bits and Windows guards named pipes by ACL. They therefore run on
Windows too, unlike the existing socket suites in this directory.

Co-Authored-By: Claude Opus 5 <[email protected]>
…denied on it

Review of the previous commit surfaced two behavioral gaps.

isProcessRunning collapsed every process.kill(pid, 0) failure into "not
running". EPERM means the process exists but is owned by another user, so a
healthy runtime observed from a sandbox was reported dead, and the new
permission_denied branch emitted app.running false with a null pid alongside
it. Only ESRCH proves death. This is the macOS half of the same defect
(stablyai#12528), where the symptom was stale_bootstrap rather than starting.

The permission_denied branch also ran before the pid-dependent fallback, so a
guarded endpoint behind a provably dead pid silently overrode stale_bootstrap.
It is now gated on liveness and the pre-existing fallback keeps precedence.

Adds regression tests for both errno paths, each verified to fail against the
unfixed code. Corrects two comments that claimed the endpoint "answered" when
the OS refuses the connection before the runtime ever sees it, and records
that the test mocks Node's error classification rather than any real
named-pipe ACL.

Co-Authored-By: Claude Opus 5 <[email protected]>
…e proves

Comment-only follow-up from review. No behaviour change.

EACCES on connect does not prove the endpoint exists - it can equally reflect
denied traversal of the directory holding the socket - so the rationale now
says the OS denied access to the transport path rather than asserting the
endpoint is present and guarded.

"Only ESRCH proves death" described a policy broader than the code, which
treats every non-EPERM errno as absent. The comment now states the actual
contract: EPERM means present, ESRCH means absent, and any other errno is
handled conservatively as absent.

Co-Authored-By: Claude Opus 5 <[email protected]>
@Flamingpuffins Flamingpuffins changed the title fix(cli): classify a permission-denied runtime connect instead of reporting starting fix(cli): classify a permission-denied runtime connect instead of reporting "starting" Aug 10, 2026
@Flamingpuffins
Flamingpuffins marked this pull request as ready for review August 10, 2026 10:23
@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b47239d4-d52c-46df-a1d6-5cb1e00d2cdd

📥 Commits

Reviewing files that changed from the base of the PR and between f70917b and 8b7e2be.

📒 Files selected for processing (3)
  • src/cli/runtime/permission-denied-classification.test.ts
  • src/cli/runtime/status.ts
  • src/cli/runtime/types.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/cli/runtime/types.ts
  • src/cli/runtime/status.ts
  • src/cli/runtime/permission-denied-classification.test.ts

📝 Walkthrough

Walkthrough

The runtime types add permission-denied error classification and a permission_denied CLI state. Transport handling maps EACCES and EPERM connection errors to dedicated runtime errors. CLI status handling reports live permission-denied runtimes with unavailable graph data. Process probes treat EPERM as alive and preserve stale handling for ESRCH. Tests cover transport and status behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: classifying permission-denied runtime connections instead of reporting starting.
Description check ✅ Passed The description covers the required summary, screenshots, testing, AI review, security audit, and notes sections with relevant detail.
Linked Issues check ✅ Passed The changes satisfy Defect 2 in #13539 and preserve stale-bootstrap behavior while explicitly limiting scope around Defect 1 and #12528.
Out of Scope Changes check ✅ Passed The liveness handling, regression tests, and permission classification changes are related to the linked issue objectives and introduce no unrelated code changes.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/cli/runtime/status.ts (1)

65-71: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reduce the new comment blocks.

Keep only the non-obvious reason at each site. Use one concise line where possible.

  • src/cli/runtime/status.ts#L65-L71: replace the branch explanation with one line that states why a live denied endpoint cannot remain starting.
  • src/cli/runtime/status.ts#L139-L143: replace the errno explanation with one line that states that EPERM means the process exists but is inaccessible.
  • src/cli/runtime/permission-denied-classification.test.ts#L8-L19: reduce the mock rationale to one concise statement about portable permission-error simulation.

As per coding guidelines, comments must be concise, limited to non-obvious information, and preferably one line.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6db55db0-a875-45c9-905b-5c51b3cb96e7

📥 Commits

Reviewing files that changed from the base of the PR and between a63df91 and f70917b.

📒 Files selected for processing (5)
  • src/cli/runtime/permission-denied-classification.test.ts
  • src/cli/runtime/status.ts
  • src/cli/runtime/transport.ts
  • src/cli/runtime/types.ts
  • src/shared/runtime-types.ts

AGENTS.md asks for concise, non-obvious comments, one line where possible.
The blocks added by this branch ran to four and seven lines and read as
narration.

Every rationale is now one to three lines with no multi-paragraph blocks,
keeping the facts that earlier review asked for: that EACCES reflects a denied
transport path rather than a proven endpoint, that EPERM means present and any
other errno is treated as absent, and that the faked connect covers errno
classification rather than real OS enforcement.

No behaviour change; comments only.

Co-Authored-By: Claude Opus 5 <[email protected]>
@Flamingpuffins

Copy link
Copy Markdown
Author

Thanks — condensed the comment blocks in 8b7e2becb, and extended it to a few sites beyond the three flagged so the file reads consistently. Net -29/+15; no block is longer than three lines now.

Kept the specifics earlier review asked for: that EACCES reflects a denied transport path rather than proving the endpoint exists, that EPERM means present with every other errno treated as absent, and that the faked connect covers errno classification rather than real OS enforcement.

Left the docstring-coverage warning as-is deliberately — AGENTS.md asks for concise, non-obvious comments, one line where possible, so adding JSDoc to reach 80% would work against the same guideline the nitpick cites. Happy to revisit if a maintainer would rather have it.

Comments only, no behaviour change: typecheck, oxlint, and the src/cli suite (732 passed) are green locally.

@tonite31

Copy link
Copy Markdown
Contributor

macOS measurement: connect() does return EPERM under the Codex seatbelt sandbox

This answers the question the PR body deliberately left open:

I have not reproduced on macOS whether the socket connect() there also returns EACCES/EPERM, so I am not claiming this resolves that issue's classification outright.

It does. Both probes this PR touches — the socket connect() and the process.kill(pid, 0) liveness check — return EPERM on macOS.

Environment

  • macOS, Darwin 25.5.0, Apple Silicon
  • Codex CLI 0.147.0, codex exec --sandbox read-only; CODEX_SANDBOX=seatbelt confirmed inside the same sandbox
  • Unix domain socket transport (transports[].kind == "unix")
  • CLI build: a fork tracking upstream. src/cli/runtime/status.ts, transport.ts and types.ts are byte-identical to upstream main (2100fb255), verified with git diff --quiet. The measured path is unmodified upstream code.

Method

A Node probe run twice against the same live runtime socket, once inside the sandbox and once outside it, seconds apart. The runtime was healthy and the app window was open throughout. The probe issues, in order: statSync, accessSync(W_OK), process.kill(pid, 0), net.createConnection(endpoint).

Results

Probe Inside seatbelt sandbox Outside (control)
stat() on endpoint succeeds — mode 600, uid 501, gid 20 same
access(W_OK) EPERM ok
process.kill(pid, 0) EPERM alive
net.connect() EPERM, syscall: "connect" connected

Raw probe line from inside the sandbox:

PROBE {"stat":{"mode":"600","uid":501,"gid":20},"access":"EPERM","kill":"EPERM","connect":"EPERM","syscall":"connect","errno":-1}

What the unpatched CLI reported at that moment, inside the sandbox:

{ "app":     { "running": false, "pid": null },
  "runtime": { "state": "stale_bootstrap", "reachable": false, "runtimeId": null },
  "graph":   { "state": "not_running" } }
{ "ok": false,
  "error": { "code": "runtime_unavailable",
             "message": "Could not connect to the running app. Restart and try again." } }

Outside the sandbox, same minute, same runtime: runtime.state: "ready", reachable: true, pid present.

The caller and the socket owner are the same uid

Worth separating from the Windows case in #13539, where the sandbox runs as a distinct account (CodexSandboxOffline / CodexSandboxOnline).

On macOS the sandboxed process runs as uid 501, and the socket is owned by uid 501 with mode 600. Ownership and mode bits are already correct and the connect is still denied — seatbelt denies the syscall itself, above the filesystem permission check.

The practical consequence: any classification that inspects endpoint ownership or mode to decide whether a denial is plausible will conclude "this should work" on macOS. The errno is the only available signal, which is what this PR keys on.

Mapping to the three changes here

Change in this PR Measured errno it keys on
transport.ts — pass err into the 'error' handler, classify EACCES/EPERM as runtime_permission_denied connect → EPERM
isProcessRunning — treat EPERM as alive rather than absent kill(pid, 0) → EPERM
status.ts — running && permission-denied → permission_denied, graph unavailable both of the above, together

macOS lands on the EPERM liveness branch, which is the case your treats an EPERM liveness probe as alive, not as a dead pid test already covers. So on this evidence macOS moves from stale_bootstrap to permission_denied under this PR, for the same reason Windows moves off starting.

Scope limit

I measured errnos against unpatched upstream code; I did not build and run this PR's branch. The claim here is only that the inputs your classification depends on are present on macOS with the values it expects — not an end-to-end verification of the patched output.

Why the current output is worse than merely unhelpful

runtime_unavailable carries "restart and try again". In the sandbox that advice is not just useless, it is actively wrong: restarting recreates the endpoint with identical permissions while the sandbox denial is unchanged. A caller told permission_denied can recover immediately — drop the sandbox for that one call, or route the lifecycle message another way. A caller told stale_bootstrap or starting has no reason to do either.

Happy to re-run the probe with any variation that would help — different sandbox modes, the websocket transport, or a build of this branch.

@tonite31

Copy link
Copy Markdown
Contributor

Follow-up to my errno measurement above — the failure then happened to me for real, and one detail is directly about this PR's reach. Full writeup on #12528: #12528 (comment)

A plain worker-start --agent codex worker (no sandbox flags anywhere) finished a real task, then had both its mid-run heartbeat and its final worker_done refused, while orca status from a non-sandboxed shell reported ready / reachable: true at the same moment. Task stayed dispatched, the coordinator received nothing, and the report died in the TUI.

The part worth flagging here: the text the worker actually saw was two layers, not one.

Could not connect to the running Orca app. Restart Orca and try again.
Orca is not running. Run 'orca open' first.

The second line comes from src/cli/format.ts:88, which appends it to every runtime_unavailable. The agent read that categorical claim as fact and stopped. So the pre-PR damage is worse than losing the errno — the CLI ends up asserting something false about the app's state.

I traced whether this PR reaches that second layer, rather than assuming it. It does: transport.ts now raises runtime_permission_denied, the format.ts:87 check for runtime_unavailable no longer matches, the error carries no nextSteps, and formatRawCliError falls through to return message at format.ts:112. The worker gets the permission-denied text with the endpoint named and none of the "not running" line. Both layers clear together, which I don't think the PR body currently claims.

Also worth noting for scope: heartbeat is affected identically. Supervision policies built on heartbeats are silently inert inside the sandbox, not just completion reporting.

Offer stands — I can re-run this end-to-end against a build of this branch if a before/after on the real orchestration path would help before merge.

@nwparker nwparker removed the P0 label Aug 19, 2026
Jinwoo-H added a commit that referenced this pull request Sep 23, 2026
…22341)

* fix(cli): report a denied runtime connection instead of a dead Orca

Inside Codex's macOS Seatbelt sandbox, connect() on the runtime socket fails
with EPERM. The CLI dropped the errno and reported "Could not connect ...
Restart Orca", appended "Orca is not running. Run 'orca open' first.", and
`orca status` answered ok:true with `starting` (its pid probe also gets EPERM).
An agent following that advice restarts a healthy app, which cannot help.

EPERM/EACCES on the metadata read or the socket/pipe connect now fails with a
CLI-local `runtime_access_denied` error: ok:false, non-zero exit,
operation/systemCode/processState:"unverifiable"/retryable:false and nextSteps
that say to re-run with escalated permissions and not restart. CODEX_SANDBOX
only picks the wording. `orca open` stops before launching.

The status pid probe is unchanged: a refused or missing socket proves the
caller reached the endpoint, so a later EPERM probe is another uid and keeps
#20098's `starting`. Missing, refused, stale-pid and timeout paths are
unchanged.

Adapted from the diagnosis and tests in #20487 (and #19605, #13583).

Co-authored-by: lifeodyssey <[email protected]>

* docs(skills): tell agents runtime_access_denied means escalate, not restart

The shared CLI-resolution block told every bundled skill to run `orca open`
when a command says Orca is not running. Add the counterpart for the new
access-denied code so sandboxed agents re-run with escalated permissions
instead of launching or restarting Orca. Regenerated stubs and manifest.

* refactor(cli): classify only a denied runtime connect, with a leaner error

A denied metadata read was never observed under a sandbox, and it turned an
unreadable user-data path (the Linux launch contract's root-owned HOME) into
runtime_access_denied instead of "Orca is not running". Keep metadata reads as
on main and classify only the socket/pipe connect.

One helper now maps a socket errno to the error or null; the error data keeps
only systemCode and nextSteps. Tests drop cases already pinned by status.test.ts.

* fix(cli): give not-running advice when a denied socket belongs to a dead Orca

A crashed Orca leaves its metadata and socket file behind, and a sandbox denies
the connect with EPERM before the CLI can see ECONNREFUSED. The sandbox still
reports ESRCH for a gone pid, so a denied connect now probes the metadata pid
and falls through to the ordinary unavailable path when the pid is proven gone.
isProcessRunning moves to its own module so transport and status share it.

* refactor(cli): inline the runtime_access_denied code like other CLI error codes

---------

Co-authored-by: lifeodyssey <[email protected]>
@nwparker

Copy link
Copy Markdown
Contributor

Thanks for this! The bug it targets (#12528) has since been fixed on main by another change, so I'm closing this as superseded. Appreciate the contribution.

@nwparker nwparker closed this Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants