mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* fix(cli): preserve runtime access across Linux PID namespaces * fix(cli): give retry advice after runtime replacement * fix(cli): preserve private offline admission policy * test(cli): align admission and launcher contracts * test(cli): prune resolved wall-clock allowance * test(cli): narrow dropped runtime errors without casts * test(cli): use explicit extension for hook service import * test(cli): replay recorded Linux sandbox denial * test: verify packaged Linux desktop CLI ownership * test: handle denied FUSE mounts in desktop fixture * test: use privileged PID namespace in desktop fixture
24 lines
1.2 KiB
TypeScript
24 lines
1.2 KiB
TypeScript
import { RuntimeClientError } from './types'
|
|
|
|
// Errno determines denial; CODEX_SANDBOX only selects wording.
|
|
export function runtimeAccessDeniedError(socketError: Error): RuntimeClientError | null {
|
|
const systemCode = 'code' in socketError ? socketError.code : undefined
|
|
if (systemCode !== 'EPERM' && systemCode !== 'EACCES') {
|
|
return null
|
|
}
|
|
const codexSandbox = Boolean(process.env.CODEX_SANDBOX)
|
|
const message = codexSandbox
|
|
? `The Codex sandbox blocked this command from connecting to Orca (${systemCode}). Orca may be running normally.`
|
|
: `Permission denied connecting to Orca (${systemCode}). Orca may be running normally; this command's sandbox or OS permissions block the connection.`
|
|
const retryStep = codexSandbox
|
|
? "Retry through Codex's existing escalation when the session permits it; otherwise run the same command from a terminal outside the sandbox."
|
|
: 'Re-run this command outside its sandbox, or as a user allowed to reach the Orca runtime.'
|
|
return new RuntimeClientError('runtime_access_denied', message, {
|
|
systemCode,
|
|
nextSteps: [
|
|
retryStep,
|
|
"Do not restart Orca or run 'orca open'; a restart cannot grant this command access."
|
|
]
|
|
})
|
|
}
|