Merge branch 'main' of https://github.com/stablyai/orca into feature-extend-ssh-host-aware-agent-session-hist

This commit is contained in:
Jinjing
2026-08-05 13:49:04 -07:00
78 changed files with 2814 additions and 3114 deletions
@@ -79,7 +79,7 @@ describe('Electron Vite output contract', () => {
expect(output.chunkFileNames).toBe('chunks/[name]-[hash].js')
})
it('externalizes packaged dependencies but bundles the daemon xterm graph', () => {
it('externalizes packaged dependencies but bundles self-contained main dependencies', () => {
const external = electronViteConfig.main?.build?.rollupOptions?.external
if (typeof external !== 'function') {
throw new Error('Expected main-process external predicate')
@@ -91,7 +91,9 @@ describe('Electron Vite output contract', () => {
expect(external('node:fs', undefined, false)).toBe(true)
expect(external('@xterm/headless', undefined, false)).toBe(false)
expect(external('@xterm/addon-serialize', undefined, false)).toBe(false)
expect(external('psl', undefined, false)).toBe(false)
expect(external('zod', undefined, false)).toBe(false)
expect(electronViteConfig.main?.build?.externalizeDeps?.exclude).toContain('psl')
expect(electronViteConfig.main?.build?.externalizeDeps?.exclude).toContain('zod')
})
@@ -35,7 +35,6 @@ const RESTRICTED_ENV_KEYS = [
'HOMEPATH',
'CODEX_HOME',
'ORCA_CODEX_HOME',
'ORCA_CODEX_SYSTEM_DEFAULT_REAL_HOME',
'ORCA_E2E_HOME_DIR',
'ORCA_E2E_USER_DATA_DIR',
'ORCA_USER_DATA_PATH',
@@ -69,7 +68,7 @@ async function resolveRealPath(candidate) {
}
}
export function createValidationEnv(inheritedEnv, layout, options = {}) {
export function createValidationEnv(inheritedEnv, layout) {
const env = { ...inheritedEnv }
for (const key of RESTRICTED_ENV_KEYS) {
delete env[key]
@@ -81,12 +80,7 @@ export function createValidationEnv(inheritedEnv, layout, options = {}) {
NODE_ENV: 'development',
ORCA_E2E_HOME_DIR: layout.homeDir,
ORCA_E2E_USER_DATA_DIR: layout.userDataDir,
ORCA_USER_DATA_PATH: layout.userDataDir,
// Why: flag OFF pins every codex spawn to an explicit managed CODEX_HOME,
// so native codex never resolves the OS profile — the only Windows
// configuration where strict zero-event containment is reachable. It also
// exercises the emergency kill-switch lane users fall back to.
ORCA_CODEX_SYSTEM_DEFAULT_REAL_HOME: options.systemDefaultRealHome === 'off' ? '0' : '1'
ORCA_USER_DATA_PATH: layout.userDataDir
}
}
@@ -268,8 +262,7 @@ function parseArgs(argv) {
primaryHome: os.homedir(),
configTemplate: null,
tempParent: null,
laneAwareContainment: false,
systemDefaultRealHome: 'on'
laneAwareContainment: false
}
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index]
@@ -299,14 +292,8 @@ function parseArgs(argv) {
options.skipBuild = true
} else if (arg === '--keep') {
options.keep = true
} else if (arg === '--system-default-real-home') {
const value = readValue()
if (value !== 'on' && value !== 'off') {
throw new Error('--system-default-real-home must be "on" or "off"')
}
options.systemDefaultRealHome = value
} else if (arg === '--lane-aware-containment') {
// Why: on Windows the flag-ON system-default lane cannot be env-sandboxed
// Why: on Windows the system-default real-home lane cannot be env-sandboxed
// (native codex ignores USERPROFILE), so strict zero-event containment is
// structurally unreachable there. This mode records codex's designed
// volatile churn without aborting while every other real-home write stays
@@ -314,7 +301,7 @@ function parseArgs(argv) {
options.laneAwareContainment = true
} else if (arg === '--help') {
console.log(
'Usage: node config/scripts/run-codex-real-account-validation.mjs [--scenario mixed|managed-only|codex-lb] [--config-template <path>] [--temp-parent <dir>] [--skip-build] [--dry-run] [--close-after-launch] [--keep] [--lane-aware-containment] [--system-default-real-home on|off] [--report <path>]'
'Usage: node config/scripts/run-codex-real-account-validation.mjs [--scenario mixed|managed-only|codex-lb] [--config-template <path>] [--temp-parent <dir>] [--skip-build] [--dry-run] [--close-after-launch] [--keep] [--lane-aware-containment] [--report <path>]'
)
process.exit(0)
} else {
@@ -480,7 +467,7 @@ async function main() {
const reportPath =
options.reportPath ??
path.join(os.tmpdir(), `orca-codex-real-account-${options.scenario}-${Date.now()}.json`)
const launchEnv = createValidationEnv(process.env, layout, options)
const launchEnv = createValidationEnv(process.env, layout)
let app = null
let tripwire = null
const abortController = new AbortController()
@@ -46,29 +46,9 @@ describe('Codex real-account validation harness', () => {
expect(env.CODEX_HOME).toBeUndefined()
expect(env.ORCA_CODEX_HOME).toBeUndefined()
expect(env.ZDOTDIR).toBeUndefined()
expect(env.ORCA_CODEX_SYSTEM_DEFAULT_REAL_HOME).toBe('1')
expect(env.SAFE_VALUE).toBe('preserved')
})
it('pins the real-home flag off when the system-default lane is disabled', async () => {
const primaryHome = path.join(os.tmpdir(), 'orca-primary-home-sentinel')
const { layout, env } = runValidationModule<{
layout: { tempRoot: string }
env: Record<string, string | undefined>
}>(
`
const { createValidationEnv, createValidationLayout } = await import(process.argv[1])
const layout = await createValidationLayout({ primaryHome: process.argv[2] })
const env = createValidationEnv({}, layout, { systemDefaultRealHome: 'off' })
console.log(JSON.stringify({ layout, env }))
`,
[primaryHome]
)
cleanupPaths.push(layout.tempRoot)
expect(env.ORCA_CODEX_SYSTEM_DEFAULT_REAL_HOME).toBe('0')
})
it('records only fingerprints for system-default and managed auth', async () => {
const { layout, snapshot } = runValidationModule<{
layout: { tempRoot: string }
@@ -483,7 +483,6 @@ async function main() {
HOME: isolatedHome,
USERPROFILE: isolatedHome,
ORCA_E2E_HOME_DIR: isolatedHome,
ORCA_CODEX_SYSTEM_DEFAULT_REAL_HOME: '0',
...(options.headful ? { ORCA_E2E_HEADFUL: '1' } : { ORCA_E2E_HEADLESS: '1' })
}
})
@@ -55,7 +55,6 @@ Object.assign(childEnv, {
ORCA_DEV_USER_DATA_PATH: profileDir,
HOME: isolatedHome,
USERPROFILE: isolatedHome,
ORCA_CODEX_SYSTEM_DEFAULT_REAL_HOME: '0',
...(process.platform === 'linux'
? { ELECTRON_DISABLE_SANDBOX: process.env.ELECTRON_DISABLE_SANDBOX ?? '1' }
: {})
@@ -219,7 +219,6 @@ async function runValidation(mode) {
ORCA_DEV_USER_DATA_PATH: userDataPath,
HOME: isolatedHome,
USERPROFILE: isolatedHome,
ORCA_CODEX_SYSTEM_DEFAULT_REAL_HOME: '0',
ELECTRON_ENABLE_LOGGING: '1',
ELECTRON_ENABLE_STACK_DUMPING: '1',
ELECTRON_OZONE_PLATFORM_HINT: 'wayland',
@@ -63,7 +63,6 @@ export function launchDevApp({ cdpPort, userDataDir }) {
ORCA_DEV_USER_DATA_PATH: userDataDir,
HOME: isolatedHome,
USERPROFILE: isolatedHome,
ORCA_CODEX_SYSTEM_DEFAULT_REAL_HOME: '0',
ORCA_SKIP_DEV_WEB_PREPARE: '1',
ORCA_STARTUP_DIAGNOSTICS: '1',
REMOTE_DEBUGGING_PORT: String(cdpPort),