Repository navigation
fix(cli): report denied runtime access without claiming process exit - #20487
lifeodyssey wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe CLI now reports distinct runtime access errors for permission-denied and unverifiable operations. Metadata reads, socket connections, and PID probes preserve these diagnostics instead of reporting runtime absence. Existing handling remains for missing metadata and refused connections. Tests cover structured errors, CLI output, status behavior, and launch prevention. Documentation describes the new error codes, fields, and access boundaries. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No unresolved merge-blocking behavior is identified in the supplied change context. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 6f89a31d-f875-4406-9247-3d9bcd455f01
📒 Files selected for processing (7)
docs/reference/runtime-access-diagnostics.mdsrc/cli/runtime/metadata-access-diagnostics.test.tssrc/cli/runtime/metadata.tssrc/cli/runtime/runtime-access-diagnostics.test.tssrc/cli/runtime/runtime-access-error.tssrc/cli/runtime/status.tssrc/cli/runtime/transport.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
ℹ️ No blocking issues — one optional documentation nit below.
Reviewed changes — reviewed the full diff of PR #20487 (fe4b53b), which classifies local runtime access denials instead of reporting a successful stale_bootstrap / starting status.
- Access classification — new
RuntimeAccessErrormapsEPERM/EACCEStoruntime_permission_denied(and other non-ESRCHPID-probe failures toruntime_unverifiable), carryingoperation,systemCode,processState: unverifiable, and an unverified metadata PID hint. - Status path —
getCliStatusrethrows access errors rather than running a second, denied PID probe;isProcessRunningreturnsfalseonly forESRCHand otherwise throws. - Transport — the socket
errorhandler preserves EPERM/EACCES as a connect access error while keepingruntime_unavailable+ restart advice for every other failure. orca open— an initial access denial rejects beforelaunchOrcaApp, so a sandboxed caller no longer spawns the app.- Tests + docs — 17 new regression tests plus
docs/reference/runtime-access-diagnostics.md.
ℹ️ Nitpicks
- The new
docs/reference/runtime-access-diagnostics.mdis neither linked fromAGENTS.md/README.mdnor added to the.gitignoreallow-list (docs/**still matches it via.gitignore:96). The.gitignorecomment scopes trackeddocs/reference/*.mdto docs linked from those files, so this one is only in the repo because it was force-added. Optional follow-up: add!docs/reference/runtime-access-diagnostics.md(alphabetically) and a link so a cleangit addreproduces the page.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — incremental re-review of abdd1f4 since the prior pullfrog review at fe4b53b; the only delta is a test-only change.
- Strengthened PID-probe assertions — the
it.eachinruntime-access-diagnostics.test.tsnow pins the exact errorcode(runtime_permission_deniedforEPERM/EACCES,runtime_unverifiableotherwise),reason(permission_denied/probe_failed), and assertsdata.systemCodeis absent when the thrown error carries nocode, closing the gap where the prior assertions would have passed under a misclassification. - Production behavior unchanged —
runtime-access-error.ts,metadata.ts,status.ts, andtransport.tsare identical to the previously reviewedfe4b53b. Re-ransrc/cli/runtime/runtime-access-diagnostics.test.ts: 13 passed.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…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 <zhenjiazhou0127@outlook.com> * 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 <zhenjiazhou0127@outlook.com>

ELI5
Orca can be healthy while a sandbox prevents a CLI caller from connecting to it. Report that access failure instead of claiming the app stopped and telling the caller to restart it.
orca openalso stops before launching anything when its initial status check is denied.What Changed
EPERM/EACCESfrom metadata reads, local socket connections, and PID probes asruntime_permission_denied.runtime_unverifiable; retain the existing stale-PID result forESRCHafter an ordinary connection failure.ok: falseenvelope with the operation, system code, andprocessState: unverifiable. A metadata PID is retained as an unverified diagnostic hint.Why
A macOS headless delivery workflow independently reproduced this on Orca 1.4.200: the same live runtime was reachable outside the Codex sandbox, while socket connection and signal-0 probing returned
EPERMinside it. Historical worker calls also alternated between failure in the sandbox and successful lifecycle delivery with command-scoped host permission, using the same runtime ID.This adapts the diagnosis and regression approach offered in #19605, whose author explicitly invited reuse and does not plan to maintain that branch. It uses distinct local error codes, as explored in #13583, so generic
runtime_unavailableformatting/recovery does not reintroduce restart advice. Unlike #16697, denied access is not projected back tostale_bootstrap.Linked Issue
Fixes #19604.
Addresses the diagnostics portion of #12528 and #13539. Their sandbox-connectivity work remains open. Downstream incident: lifeodyssey/animichi#1648.
Visual Proof
N/A — no rendered UI changes. CLI behavior was checked against a running packaged 1.4.200 runtime, without restarting it:
ok: true,stale_bootstrap,app.running: falseok: false,runtime_permission_denied,systemCode: EPERM,processState: unverifiableready, reachableready, reachableOnly sanitized results are included; raw logs, tokens, endpoint paths, and private session identifiers are not published.
Testing
src/clisuite: 1,218 passed, one existing 250 ms timeout-override test failed during concurrent validation. Rerunning its entireruntime-client.test.tsfile passed all 15 tests; the initial failure is disclosed rather than counted as a clean full-suite run.pnpm run check:code-quality:changed, andpnpm run build:clipassed.pnpm lintand all node/web/CLI typecheck projects passed. Full repository tests and desktop/native packaging were not run locally and remain for CI; no visible Electron tests were launched on the user's desktop.AI Disclosure
OpenAI Codex (GPT-6) assisted with diagnosis, implementation, test execution, and self-review under the contributor's direction. Prior art and adapted regression ideas are credited to #19605 and #13583.
Review
Self-review covered error precedence, the error-then-close socket sequence, no request write after a denied connection, no app launch after denied discovery, JSON/human output, secret redaction, and preservation of ordinary missing/refused/starting behavior. No independent review is claimed.
Agent skill upstream boundary
Notes
worker_donedelivery or assert exactly-once settlement. That requires an authorized lifecycle channel and remains separate.Author
GitHub: @lifeodyssey. X/Twitter: not provided.
Checklist