mirror of
https://github.com/stablyai/orca.git
synced 2026-10-18 08:03:22 +00:00
fix(codex): address CodeRabbit review on the landing PR
- carry envToDelete through the mobile agent-resume startup plan so a real-home Codex resume cannot inherit an ambient CODEX_HOME - strip Orca-owned Codex overrides in the commit-message WSL fallback, matching the host fallback - strip ELECTRON_RUN_AS_NODE in the computer-e2e driver like every other home-isolation caller - drop the unused hooksEnabled parameter from isRealHomeCodexHookLaneUsable
This commit is contained in:
@@ -52,7 +52,7 @@ export function getRealHomeCodexHookLane(): RealHomeCodexHookLane {
|
||||
* a failed opt-out cleanup use the managed lane so no half-mutated hook state
|
||||
* can diverge from PTY, rate-limit, or commit-message routing.
|
||||
*/
|
||||
export function isRealHomeCodexHookLaneUsable(_hooksEnabled: boolean): boolean {
|
||||
export function isRealHomeCodexHookLaneUsable(): boolean {
|
||||
return currentLane !== 'unavailable'
|
||||
}
|
||||
|
||||
|
||||
+1
-3
@@ -1764,9 +1764,7 @@ app.whenReady().then(async () => {
|
||||
codexRuntimeHome = new CodexRuntimeHomeService(store)
|
||||
// Why: an incapable trust-grant host must fall back to the managed home for
|
||||
// every consumer (PTY env, rate limits, commit messages) in one place.
|
||||
codexRuntimeHome.setRealHomeLaneGate(() =>
|
||||
isRealHomeCodexHookLaneUsable(isAgentStatusHooksEnabled(store?.getSettings()))
|
||||
)
|
||||
codexRuntimeHome.setRealHomeLaneGate(() => isRealHomeCodexHookLaneUsable())
|
||||
// Why: while the real-home lane owns ~/.codex/hooks.json, the legacy
|
||||
// system-home sweep inside managed installs would delete the entry the
|
||||
// real-home installer just appended. Flag OFF, hooks off, or an incapable
|
||||
|
||||
@@ -19609,6 +19609,9 @@ export class OrcaRuntimeService {
|
||||
return {
|
||||
command: startupPlan.launchCommand,
|
||||
env: startupPlan.env,
|
||||
// Why: a real-home Codex resume strips inherited CODEX_HOME via
|
||||
// envToDelete; dropping it here would resume against the wrong home.
|
||||
envToDelete: opts.envToDelete,
|
||||
launchConfig: startupPlan.launchConfig,
|
||||
launchAgent: opts.agent,
|
||||
startupCommandDelivery: startupPlan.startupCommandDelivery
|
||||
|
||||
@@ -100,11 +100,13 @@ export async function prepareLocalCommitMessageAgentEnv(
|
||||
const wslCodexHome = codexHomePath ? parseWslUncPath(codexHomePath) : null
|
||||
if (target?.runtime === 'wsl') {
|
||||
const codexHomeForTarget = wslCodexHome?.linuxPath ?? null
|
||||
// Why: the fallback must still strip Orca-owned overrides, or a
|
||||
// system-default WSL run inherits the managed CODEX_HOME.
|
||||
return {
|
||||
ok: true,
|
||||
env: codexHomeForTarget
|
||||
? { ...cloneProcessEnv(), CODEX_HOME: codexHomeForTarget }
|
||||
: undefined
|
||||
? { ...cloneProcessEnvWithoutOrcaCodexHomeOverride(), CODEX_HOME: codexHomeForTarget }
|
||||
: cloneProcessEnvWithoutOrcaCodexHomeOverride()
|
||||
}
|
||||
}
|
||||
if (codexHomePath && wslCodexHome) {
|
||||
|
||||
@@ -166,8 +166,12 @@ async function ensureOrcaRuntimeServed(): Promise<void> {
|
||||
async function createComputerE2ERuntimeEnv(): Promise<NodeJS.ProcessEnv> {
|
||||
const userDataDir =
|
||||
process.env.ORCA_DEV_USER_DATA_PATH ?? (await getComputerE2eOrcaDevUserDataPath())
|
||||
// Why: agent runtimes export ELECTRON_RUN_AS_NODE, which would make the
|
||||
// spawned Electron behave as plain Node; strip it like every other caller.
|
||||
const { ELECTRON_RUN_AS_NODE: _electronRunAsNode, ...inheritedEnv } = process.env
|
||||
void _electronRunAsNode
|
||||
const isolation = createElectronHomeIsolation({
|
||||
inheritedEnv: process.env,
|
||||
inheritedEnv,
|
||||
launchEnv: {},
|
||||
extraEnv: {},
|
||||
userDataDir,
|
||||
|
||||
Reference in New Issue
Block a user