Repository navigation
feat(settings): let Codex terminals opt back into Codex's shared server - #23929
Conversation
…d server Off injects ORCA_CODEX_ISOLATE=0 into new terminals on every host (local, daemon, SSH relay, WSL), which the codex shell wrapper from #23900 reads to skip --no-daemon. On (the default) injects nothing.
Shows a one-time toast the first time a Codex terminal starts, with an Open Settings action that lands on the new Codex server setting. The seen flag persists in UI state and is set when the toast is shown.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
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 (7)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe change adds a default-on Codex terminal-server isolation setting and applies it to renderer and runtime PTY spawn environments. The Agents settings pane exposes the setting outside paired web-client windows. A persisted notice appears when Codex activity is detected and isolation is enabled. Its action opens the relevant settings target. Priority: ⬇️ Low Merge Risk: 🔵 Low · up to Paired web-client users may see a search result for a setting they cannot access in that window. This is a localized usability issue with a reasonable workaround. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The isolated mode remains the default. Turning it off deliberately restores Codex’s existing shared-server behavior for new terminals, including its session-status and lifetime trade-offs. No credential or privilege expansion was demonstrated, but behavior across deployed terminal hosts and mixed-mode sessions remains unverified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 21 files. (1 skipped: 1 unsupported.) ✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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: 2c3d2336-251c-4f93-aad6-28bfcbbb2089
📒 Files selected for processing (22)
src/main/ipc/pty/ipc/spawn-options-codex-isolation.test.tssrc/main/ipc/pty/ipc/spawn-options.tssrc/main/ipc/pty/runtime/spawn-options.tssrc/main/pty/wsl-orca-env.test.tssrc/relay/pty-handler-spawn-environment.test.tssrc/renderer/src/app-shell/use-app-shell-services.tssrc/renderer/src/components/settings/AgentsPane.tsxsrc/renderer/src/components/settings/CodexTerminalServerIsolationSetting.tsxsrc/renderer/src/components/settings/agents-search.tssrc/renderer/src/components/settings/codex-terminal-server-isolation-copy.tssrc/renderer/src/components/terminal-pane/codex-terminal-server-isolation-notice.test.tssrc/renderer/src/components/terminal-pane/codex-terminal-server-isolation-notice.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/lib/settings-navigation-types.tssrc/renderer/src/store/slices/ui/ui-slice-contract-contextual.tssrc/renderer/src/store/slices/ui/ui-slice-hydration-actions.tssrc/renderer/src/store/slices/ui/ui-slice-trust-actions.tssrc/shared/codex-terminal-server-isolation.tssrc/shared/default-global-settings.tssrc/shared/global-settings-types.tssrc/shared/persisted-ui-state-types.tssrc/shared/rpc-contract/client-ui-params.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
Important
The default-on isolation can be silently overridden by an inherited ORCA_CODEX_ISOLATE: the "on" path injects nothing, but no env builder drops a value already present in the host process environment. A host process carrying ORCA_CODEX_ISOLATE=0 leaks it into setting-on terminals and disables isolation on local, daemon, and SSH paths. Details below.
Reviewed changes
- New setting:
codexTerminalServerIsolation(defaulttrue, absent reads as on) inglobal-settings-types.ts/default-global-settings.ts, rendered as a switch in Settings → Agents and hidden on paired web clients. - Spawn-time injection:
withCodexTerminalServerIsolationEnvaddsORCA_CODEX_ISOLATE=0when the setting is off, called from bothipc/spawn-options.tsandruntime/spawn-options.ts; the existingcodexwrapper reads the variable. - One-time notice:
useCodexTerminalServerIsolationNoticewith a persistedcodexTerminalServerIsolationNoticeSeenflag, triggered by an Orca-launched Codex tab, a hook-reported Codex row, or a foregroundcodex. - Tests: spawn-env on both hosts, relay passthrough, WSLENV forwarding, and the notice hook.
I confirmed verify:localization-extraction, audit-localization-coverage, and check:code-quality:changed pass, both new test files pass, and independently verified the notice hook cannot double-fire or miss-fire across hydration/StrictMode ordering.
⚠️ An inherited ORCA_CODEX_ISOLATE is never dropped, so "on" does not guarantee isolation
The setting is implemented as "inject nothing when on", which is correct only if nothing else supplies the variable. Every provider builds its final spawn env by merging process.env and then the explicit spawn env, and each already scrubs sibling Orca-owned keys (ORCA_CODEX_LAUNCH_PREFLIGHT, ORCA_HISTFILE, fish_history, pane identity) for exactly this reason. ORCA_CODEX_ISOLATE is absent from all of those scrub lists, so a host process that carries ORCA_CODEX_ISOLATE=0 (for example a daemon or relay started from an Orca pane whose setting was off) silently flips setting-on terminals back to Codex's shared server — the opposite of what the switch and the one-time notice promise.
Technical details
# Inherited `ORCA_CODEX_ISOLATE` reaches setting-on terminals
## Affected sites
- `src/shared/codex-terminal-server-isolation.ts:22-25` — the enabled branch returns `env` unchanged; it neither adds nor removes the key.
- `src/main/providers/local-pty-spawn-environment.ts:25-26` — final env is `{ ...process.env, ...spawn.env }`; nothing deletes `ORCA_CODEX_ISOLATE`.
- `src/main/daemon/pty-subprocess/spawn-environment.ts:169-177` — same merge; conditional drops exist for pane identity, `fish_history`, `HISTFILE`, `ORCA_HISTFILE` but not this key.
- `src/relay/pty-handler.ts:849` — unconditionally deletes `ORCA_CODEX_LAUNCH_PREFLIGHT`; there is no matching delete for `ORCA_CODEX_ISOLATE`.
- `src/relay/pty-handler-spawn-environment.test.ts:366-375` — the new test only proves a client-supplied `ORCA_CODEX_ISOLATE=0` is preserved; it never seeds the relay process env, unlike the adjacent `ORCA_CODEX_LAUNCH_PREFLIGHT` test which is parameterized over `['process', 'client']`.
- `src/main/pty/wsl-orca-env.ts:85` — `ORCA_CODEX_ISOLATE/u` is forwarded whenever the value is truthy (`'0'` is), so a leaked value also crosses into WSL.
## Required outcome
A setting-on spawn must not inherit `ORCA_CODEX_ISOLATE` from the host process, while a setting-off spawn must still deliver its explicit `0`.
## Suggested approach (optional)
The two spawn-options builders already thread an `envToDelete` list into every provider builder (daemon `deleteRequestedDaemonEnvKeys`, local `enforceLocalPtySpawnEnvironmentOverrides`, relay `:851-853`). When isolation is on, add `CODEX_ISOLATE_ENV` to that list so all providers drop the inherited value in one place; a follow-up unit test seeding `process.env.ORCA_CODEX_ISOLATE` and omitting it from the spawn env would pin it.
## Open questions for the human (optional)
Is an inherited `ORCA_CODEX_ISOLATE` considered in scope to drop, or is the host process env assumed free of it?ℹ️ Nitpicks
src/renderer/src/components/settings/codex-terminal-server-isolation-copy.ts:25-32— thesettings.agents.codexTerminalServerIsolation.search.*keys are passed throughsearchKeywordsspecs, which the extractor does not scan, so they never enteren.jsonand stay English-only. Every neighbouring entry usesauto.*catalog keys; reusing the existingauto.components.settings.agents.search.*keys (asagent-status-hooks-copy.tsdoes forcodex/status) would keep these translated.src/renderer/src/components/terminal-pane/codex-terminal-server-isolation-notice.test.ts— the mocked store selector is non-reactive (selector(backing.getState())) andresetStorealways seedspersistedUIReady: true, ...NoticeSeen: falsebefore mount, so the realseen: true → false-after-mount re-run (the only path that exercises React's reactive selector) is untested. The production store is reactive so this is coverage, not a bug.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| export function getCodexTerminalServerIsolationDescription(): string { | ||
| return translate( | ||
| 'settings.agents.codexTerminalServerIsolation.description', | ||
| "Keeps Orca's status and closing tabs working correctly. Turn off to use Codex's shared server and its agents overview. Applies to new terminals." |
There was a problem hiding this comment.
Shared-server risk is omitted The setting no longer warns that turning off isolation can make Orca’s Codex status inaccurate. Users choosing the shared server for its agents overview see the benefit but not this known trade-off at the point of choice. Please restore an explicit warning in the setting description.
Knowledge Base Used: Agent integrations and hooks
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| id: 'codex-terminal-server-isolation-notice', | ||
| description: translate( | ||
| 'terminal.codexTerminalServerIsolationNotice.description', | ||
| 'This makes status more reliable. You can turn it back on in Settings.' |
There was a problem hiding this comment.
Notice reverses switch guidance The notice says users can “turn it back on,” but Open Settings leads to a switch labeled “Run each Codex terminal on its own server” that is already on. Users must turn that switch off to restore Codex’s shared server. The revised notice also no longer explains that isolated Orca terminals are absent from Codex’s agents overview, so users may miss why they would change the setting. Please say explicitly what turning the switch off restores.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Keeps main's agent workspace trust setting beside this branch's Codex terminal server isolation setting in the settings types, defaults, Agents pane and its search entries.
Gives its search entry an id and gates it with includeCodexTerminalServerIsolation, as the other host-only rows are, so a paired web client cannot find a row it never renders. Its search keywords now use catalogued agents-search keys instead of missing ones; CODEX_ISOLATE_ENV is no longer exported; the toast id comment names the case it guards.
|
@pullfrog re the inherited |
|
Agreed — withdrawing the inherited Verified the rationale against the code: on Also resolved the now-fixed paired-web search-entry thread (
|
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions inline.
Reviewed changes
- Paired-web search leak fixed: the Codex setting's search entry now carries an
idand is gated byincludeCodexTerminalServerIsolation, whichbuildCapabilitySettingsSectionsthreads from!isWebClient, matching the neighboring host-only rows. - Search keywords localized: hand-written
settings.agents.codexTerminalServerIsolation.search.*keys replaced with sharedauto.components.settings.agents.search.*catalog keys. - Dead export removed:
CODEX_ISOLATE_ENVis no longer exported; it was only read insidecodex-terminal-server-isolation.ts. - Tests/comment: added a paired-web assertion in
AgentsPane.test.tsxand reworded the notice's stable-id comment.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…ata builder Calling getAgentsPaneSearchEntries directly stayed green with the web gate deleted; the metadata builder test fails without it.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run covered the delta since the prior pullfrog review (8fca14511e) — the test-only commit c676c8f192 that closes out the last open thread.
- Paired-web search gate pinned through the builder:
useSettingsNavigationMetadata.test.tsnow builds real navigation metadata and asserts the Codex server setting is listed in desktop Agents search and absent for a web client, replacing the test that calledgetAgentsPaneSearchEntrieswith the option directly. AgentsPane.test.tsxtrimmed: the paired-web case now asserts only that the row does not render; the option-filter search assertions live with the other search coverage.
I verified the new test is falsifiable: removing includeCodexTerminalServerIsolation: !isWebClient from settings-navigation-capability-sections.ts:47 fails it. Both affected test files pass (57 tests).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…setting # Conflicts: # src/main/ipc/pty/ipc/spawn-options.ts # src/main/ipc/pty/runtime/spawn-options.ts
…er (#23929) * feat(settings): add a setting to run Codex terminals on Codex's shared server Off injects ORCA_CODEX_ISOLATE=0 into new terminals on every host (local, daemon, SSH relay, WSL), which the codex shell wrapper from #23900 reads to skip --no-daemon. On (the default) injects nothing. * feat(terminal): announce per-terminal Codex servers once Shows a one-time toast the first time a Codex terminal starts, with an Open Settings action that lands on the new Codex server setting. The seen flag persists in UI state and is set when the toast is shown. * fix(settings): drop the status warning from the Codex server setting * fix(terminal): simplify the Codex shared-server notice * fix(terminal): say agent status in the Codex notice * fix(settings): hide the Codex server setting from paired web search Gives its search entry an id and gates it with includeCodexTerminalServerIsolation, as the other host-only rows are, so a paired web client cannot find a row it never renders. Its search keywords now use catalogued agents-search keys instead of missing ones; CODEX_ISOLATE_ENV is no longer exported; the toast id comment names the case it guards. * test(settings): assert the Codex server search gate through the metadata builder Calling getAgentsPaneSearchEntries directly stayed green with the web gate deleted; the metadata builder test fails without it. Backport: #23744 (workspace trust setting) is not on this branch, so its adjacent setting, search entry and test are left out. (cherry picked from commit a0abcb6)
…rch keywords to Chinese Upstream added settings.agents.codexTerminalServerIsolation.* and codexSharedServerWarning.* (stablyai#23929, stablyai#24217) with English only, so the Agents pane showed both rows untranslated; five of their settings-search keywords were missing too.

ELI5
Since #23900, every Codex terminal in Orca runs on its own private Codex server, which keeps Orca's status and tab closing correct. Some people still want Codex's shared server (for example, to see all their sessions in Codex's agents overview). This PR adds a switch for that in Settings, plus a one-time notice that tells people about the change and links to the switch.
What Changed
codexshell wrapper from fix(terminal): run Codex in Orca terminals without the shared background server #23900 adds--no-daemon.ORCA_CODEX_ISOLATE=0, the opt-out the fix(terminal): run Codex in Orca terminals without the shared background server #23900 wrapper already reads, socodexruns unchanged on the shared server. Terminals that are already open keep the environment they started with.ipc/spawn-options.ts) and runtime/CLI/mobile spawns (runtime/spawn-options.ts). All providers read their environment from there: local node-pty, the terminal daemon, and the SSH relay. The daemon and the relay pass the spawn environment through unchanged. WSL already forwardsORCA_CODEX_ISOLATE/uthroughWSLENV(from fix(terminal): run Codex in Orca terminals without the shared background server #23900). Nothing changes inside the daemon, so there is no daemon protocol bump.codexdetected in the foreground of a local pane. Other agents never trigger it. It doesn't show if the user already turned the setting off.codexTerminalServerIsolationNoticeSeenis set at the moment the toast is shown. This follows theupdateReassuranceSeenpattern, including an entry in theui.setschema for paired clients. Once the flag is set, the hook no longer subscribes to the store, so it costs nothing. Until then, it checks only when tabs, agent status, foreground agents or settings change.Why
--no-daemonwork reads the same variable from the spawn environment.ORCA_CODEX_ISOLATEstill works.codex --helpinside the shell and never reports the result. Adding acodex --versioncheck in the main process wouldn't cover SSH or WSL. So the notice fires on the first Codex terminal. On older Codex it is still true: each terminal already runs its own process.Linked Issue
Refs #22873 (STA-8467), follows #23900.
Visual Proof
Setting on (default):

Setting off (toggled by clicking the switch after following the toast's Open Settings link):

Notice on the first Codex terminal (Codex runs against an isolated CODEX_HOME/HOME, so its sign-in screen shows):

New terminal with the setting on:

ORCA_CODEX_ISOLATEis unset and the wrapper passes--no-daemon(fakecodex0.157 binary, confirmed viawhence -p):New terminal with the setting off:

ORCA_CODEX_ISOLATE=0, and the wrapper leaves the args alone:After a full app restart, with a Codex tab open, no toast appears:

Testing
ORCA_BACKGROUND_LAUNCH=1) with an isolated profile, HOME and CODEX_HOME, driven over CDP. Terminals ran through the isolated terminal daemon. The toast appeared once, Open Settings landed on the setting, and the toast did not come back after a renderer reload, a new Codex tab or an app restart.echoshowedORCA_CODEX_ISOLATEonly when the setting was off. SSH and WSL were not run live. They are covered by unit tests: the relay keeps the client's value, and WSLENV includesORCA_CODEX_ISOLATE/u.spawn-options-codex-isolation.test.ts: renderer and runtime spawn paths, local and SSH connections, setting on/absent means nothing is injected, off meansORCA_CODEX_ISOLATE=0.pty-handler-spawn-environment.test.ts: the relay keeps the client opt-out.wsl-orca-env.test.ts: the opt-out is forwarded into WSL.codex-terminal-server-isolation-notice.test.ts: shows once and marks it seen; triggers on launch, hook and foreground Codex; never triggers for other agents; stays quiet when already seen, opted out, or before persisted UI loads; the action navigates to the setting.pnpm tc, oxlint,check:code-quality:changed, localization extraction/coverage, the runtime localization catalog check and the RPC params catalog pass.en-runtime-required.jsongains the new search keywords (regenerated with the catalog script).Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)