Repository navigation
Conversation
Add an "Isolate external agent config" setting (default off). When on, Orca writes no agent CLI config, trust files or credentials outside its own data directories: - managed status hooks (local and remote) are not installed, and status hooks read as off everywhere they are checked - Codex: no real-home hook ensure, no hook-approval promotion, no settings write-back/mirror pass into ~/.codex - folder trust presets (Cursor, Copilot, Antigravity, Codex real home, and SSH remotes) are skipped; Codex's Orca-owned runtime config still gets trust - Claude runtime credential sync is skipped; turning isolation on first switches back to the system-default login so a managed account is not left in ~/.claude, and selecting a managed account while isolated is rejected Turning isolation off re-runs hook reconciliation. Removing hooks via the status-hooks toggle still works while isolated. Refreshed Codex system-default tokens are still written back to ~/.codex/auth.json so the user's own Codex login keeps working. Tests: a unit test snapshots a fake HOME across every gated writer with a negative control, and an E2E spec launches the built app against a seeded, disposable HOME with isolation on and off.
…ated The hooks switch keeps its stored value while isolation forces hooks off, so its description now says they are paused and that switching it off removes hooks Orca installed earlier.
There was a problem hiding this comment.
Important
The opt-in switch is well-placed, but the isolation promise does not hold on every activation path and a few external writers are still ungated — most notably a Windows+WSL Codex auth drain and the offline CLI agent hooks on. Details below.
Reviewed changes
- New isolation module —
src/main/agent-config-isolation.tsadds a live settings reader, per-writer gate, fail-closed reads, and a release-task registry invoked when the flag turns on. - Writers gated at entry — managed local/remote hook install, Codex real-home/mirror/trust-promotion, all four folder-trust presets, remote trust, and Claude credential sync/selection.
- Settings + UI — new optional
isolateExternalAgentConfig(defaultfalse),settings:setrelease-on-enable / reconcile-on-disable, and an Agents-pane switch with paused copy/search strings. - Tests — unit coverage for the gates plus an E2E that seeds the flag into a disposable HOME.
⚠️ Isolation is only enforced on the renderer toggle path
The release task is wired solely to settings:set. A user who enables the flag by editing the persisted profile — the config-as-code workflow this feature targets, and exactly what the new E2E does — gets no release. On the next launch isExternalAgentConfigIsolated() is already true when ClaudeRuntimeAuthService is constructed, so doSyncForCurrentSelection early-returns and a previously materialized managed login stays in ~/.claude. No startup or periodic reconciliation clears a managed selection or hands the user's own login back while isolated.
Technical details
# Non-IPC activation never releases Orca-owned state
## Affected sites
- `src/main/claude-accounts/runtime-auth-service.ts:12-16` — constructor runs `initializeLastSyncedState()` + `safeSyncForCurrentSelection()`; with the flag already persisted, `doSyncForCurrentSelection` early-returns.
- `src/main/claude-accounts/runtime-auth/runtime-auth-sync.ts:19-21` — the early return.
- `src/main/startup/main-process-account-services.ts:79-83` — the only `onBeforeAgentConfigIsolation` registration, invoked only from `settings:set`.
- `src/main/ipc/settings.ts:200-202` — the sole trigger.
- `src/main/startup/main-process-ready-foundation.ts:144` — reader installed before account services, so the flag is live at construction.
## Required outcome
If isolation is on, no managed Claude account may be selected or materialized, regardless of how the flag was set (UI toggle, profile-file edit, web client).
## Suggested approach
Reconcile at startup: when `isExternalAgentConfigIsolated()` and a managed selection exists, clear the selection without re-materializing. A test that seeds an active managed account plus the flag into `orca-data.json` and asserts `~/.claude` is restored would pin it.
## Open questions
- Is setting the flag directly in `orca-data.json` considered a supported configuration, or UI-only? The PR body and the E2E both imply the former.⚠️ External writes remain on Windows+WSL and in the offline CLI
Three paths still touch user-owned agent config while the flag is on: the WSL legacy Codex auth drain writes the distro's real ~/.codex/auth.json/.credentials.json; orca agent hooks on run offline installs hooks into real agent configs because it never passes the flag and the CLI has no reader configured; and the ~/.orca/claude-agent-teams-bin shim is written ungated even though the new E2E lists it as an agent-config root.
Technical details
# Ungated writers reachable with `isolateExternalAgentConfig: true`
## Affected sites
- `src/main/codex-accounts/runtime-home-service-wsl.ts:146-147` — system-default match resolves the destination to the distro's real `~/.codex`.
- `src/main/codex-accounts/legacy-wsl-runtime-auth-drain.ts:150-165` — passes that `linuxHomePath` as the drain target.
- `src/main/codex-accounts/legacy-wsl-runtime-auth-drain-scripts.ts:194,209,274` — `mv`/`cp` into `$target_home/auth.json` and `.credentials.json`.
- `src/cli/handlers/agent-hooks.ts:126-145` — `updateEnabledOnDisk` returns only `agentCmdOverrides`/`disabledTuiAgents`, dropping `isolateExternalAgentConfig`.
- `src/cli/handlers/agent-hooks.ts:200` — `applyAgentStatusHooksEnabled(enabled, offlineUpdate?.settings)`; the CLI never calls `configureAgentConfigIsolation`, so `isExternalAgentConfigIsolated()` is false and the narrowed settings omit the flag, so the gate does not trip.
- `src/cli/handlers/agent-hooks.ts:106-124` — `readHookSettings` also drops the flag.
- `src/main/runtime/claude-agent-teams-shim-env.ts:20-27,87` — writes `~/.orca/claude-agent-teams-bin/tmux(|.cmd)`, unrelated to the hooks flag.
- `tests/e2e/external-agent-config-isolation.spec.ts:48-49` — the E2E itself classifies `.orca/agent-hooks` and `.orca/claude-agent-teams-bin` as agent-config roots.
## Required outcome
Every external write path is gated on the live flag, not only the ones this PR enumerated. Reads may stay.
## Suggested approach
Gate the WSL drain destination resolution on `isExternalAgentConfigIsolated()`; spread the full persisted settings in `updateEnabledOnDisk`/`readHookSettings` so the CLI gate sees the flag; gate the shim writer if `~/.orca` is in scope (the E2E suggests it is).
## Open questions
- Is `~/.orca/claude-agent-teams-bin` intentionally outside the isolation contract? The E2E allowlist implies otherwise.ℹ️ Nitpicks
getIsolateExternalAgentConfigDescription()promises no credential writes, but the Codex system-default token refresh still writes~/.codex/auth.json(src/main/codex-accounts/runtime-home-service-auth-sync.ts:274-278, acknowledged out of scope in the PR body). Turning status hooks off while isolated also performs an external hook removal. Worth a word in the copy so the switch matches what actually happens.src/renderer/src/components/settings/agents-search.tsreusesgetAgentStatusHooksSearchKeywords()for the isolation entry, so searching for one surfaces both.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. 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 (2)
🚧 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; 7 remain after this review. 📝 WalkthroughWalkthroughAdds an opt-in setting, off by default, to isolate external agent configuration. When enabled, the main process gates agent hook installation, trust updates, Codex configuration writes, and Claude account credential synchronization. Enabling isolation first runs registered release tasks, including deselection of managed Claude accounts. The Agents settings pane exposes the toggle and paused-hook information. Unit and end-to-end tests cover isolation behavior and non-isolated comparisons. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The reviewed isolation behavior presents no established merge-blocking risk. Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 3 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
🚥 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: 6
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 96b91ef6-b74f-4934-bdc5-fd4843210ad2
📒 Files selected for processing (24)
config/tsconfig.cli.jsonsrc/main/agent-config-isolation.test.tssrc/main/agent-config-isolation.tssrc/main/agent-hooks/managed-agent-hook-controls.tssrc/main/agent-hooks/remote-managed-hook-installers.tssrc/main/agent-trust-presets.tssrc/main/claude-accounts/claude-account-selection.tssrc/main/claude-accounts/claude-account-service-account-selection.test.tssrc/main/claude-accounts/runtime-auth/runtime-auth-sync.tssrc/main/codex/codex-config-mirror.tssrc/main/codex/codex-real-home-hook-install.tssrc/main/codex/hook-trust-promotion.tssrc/main/ipc/settings.tssrc/main/remote-agent-trust-presets.tssrc/main/startup/main-process-account-services.tssrc/main/startup/main-process-ready-foundation.tssrc/renderer/src/components/settings/AgentsPane.tsxsrc/renderer/src/components/settings/agent-status-hooks-copy.tssrc/renderer/src/components/settings/agents-search.tssrc/renderer/src/i18n/en-runtime-required.jsonsrc/renderer/src/i18n/locales/en.jsonsrc/shared/default-global-settings.tssrc/shared/global-settings-types.tstests/e2e/external-agent-config-isolation.spec.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.
- Propagate release failures so isolation is not saved while a managed Claude login may still be materialized - Reconcile at startup when isolation is already on (e.g. set in the profile file), releasing managed selections for host and every WSL distro - Scope the release's own restore write with AsyncLocalStorage so other writers stay blocked during it - Stop WSL hook relays when isolation turns on - Carry the flag through offline `orca agent hooks on` - Skip the system-default WSL Codex auth drain into the distro's ~/.codex - Qualify the setting copy (Codex token sync, hook removal) and give it its own search keywords - E2E: snapshot only agent-config roots and tolerate vanishing files
…terialized A credential sync that skipped its restore looks like success, so the release now checks the runtime-auth state after deselecting and fails, keeping isolation off, if a managed Claude login is still synced. The release task moves to claude-isolation-release.ts so it can be tested, and a test pins the release scope across two busy mutation queues.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Failed releases now reject —
releaseExternalAgentStateBeforeIsolationruns every task, then throws if any failed, sosettings:setno longer persists isolation when a managed login can't be handed back; the previously open thread is retired. - Startup reconciliation — when isolation is already set and a managed selection exists, startup fires the release, covering activation via the profile file or another client.
- Release confined by
AsyncLocalStorage— isolation readsfalseonly inside the release chain, so concurrent and queued writers outside it stay blocked. - Windows+WSL Codex drain gated — the system-default destination resolves to
nullwhile isolated, leaving the drainpendinginstead of writing the distro's~/.codex. - Offline CLI honors the flag —
orca agent hooks onnow carriesisolateExternalAgentConfigthroughupdateEnabledOnDisk, so the offline install gate trips. - Contract and copy tightened — the E2E allowlist drops the Orca-owned teams shim, the isolation copy discloses the Codex token exception, and the entry gets its own search keywords.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
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: 7ac00a6b-7efb-4bee-8d74-6e8bfe79e2ff
📒 Files selected for processing (16)
src/cli/handlers/agent-hooks.tssrc/cli/runtime-client-deferral.test.tssrc/main/agent-config-isolation.test.tssrc/main/agent-config-isolation.tssrc/main/claude-accounts/claude-isolation-release.test.tssrc/main/claude-accounts/claude-isolation-release.tssrc/main/claude-accounts/runtime-auth-service.tssrc/main/claude-accounts/runtime-selection.tssrc/main/codex-accounts/runtime-home-service-wsl.tssrc/main/startup/main-process-account-services.tssrc/main/startup/main-process-ready-foundation.tssrc/renderer/src/components/settings/agent-status-hooks-copy.tssrc/renderer/src/components/settings/agents-search.tssrc/renderer/src/i18n/en-runtime-required.jsonsrc/renderer/src/i18n/locales/en.jsontests/e2e/external-agent-config-isolation.spec.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/i18n/locales/en.json
- src/renderer/src/i18n/en-runtime-required.json
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Between restoring the user's own login and persisting the isolation flag, a concurrent Claude account selection still saw isolation off and could materialize a managed login. The release now marks the transition pending; outside the release chain it reads as isolated until the flag is persisted, and a failed release clears it so isolation stays off.
There was a problem hiding this comment.
Important
The release-to-persist guard can leave isolation wedged on after a successful enable, so turning the setting off in the same session may not take effect until a restart.
Reviewed changes
- Added a release-to-persist isolation window — a module-global
transitionPendingis ORed intoisExternalAgentConfigIsolated(), so writers outside the release chain report isolation from the start of a release until the flag is persisted. - Extended the offline CLI expectation —
runtime-client-deferral.test.tsnow expectsisolateExternalAgentConfig: falsein the offline hooks settings payload.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| if (persisted) { | ||
| transitionPending = false | ||
| } | ||
| return persisted || transitionPending |
There was a problem hiding this comment.
transitionPending clears only on a read that sees the persisted flag true. The settings:set on-transition never performs that read: the settings listener calls the settings-based isAgentStatusHooksEnabled, and hookSettingChanged is false on an enable, so applyAgentStatusHooksEnabled is not invoked. The flag therefore survives into a later disable, where updateSettings persists false but the off-reconcile reads transitionPending as true — hooks are not reinstalled, and every gated writer stays blocked until restart.
Technical details
# Sticky transitionPending wedges isolation on after a successful toggle
## Affected sites
- `src/main/agent-config-isolation.ts:41-44` — `transitionPending` is cleared only when a read sees `persisted === true`; a read that sees `false` leaves it set.
- `src/main/agent-config-isolation.ts:63` — set at release start.
- `src/main/agent-config-isolation.ts:74` — cleared only on release failure.
- `src/main/ipc/settings.ts:200-207` — ON: release runs, then `updateSettings` persists; no live read occurs.
- `src/main/ipc/settings.ts:238-257` — OFF: `didIsolationTurnOff` is true, so `applyAgentStatusHooksEnabled` runs and `isHookInstallIsolated` reads the live flag with `persisted === false`.
- `src/main/startup/main-process-ready-foundation.ts:243` — the settings listener uses `isAgentStatusHooksEnabled(settings)`, not the live reader, so it does not settle the flag.
## Required outcome
Turning isolation off must take effect without a restart: the next `isExternalAgentConfigIsolated()` after the off write must return `false`, and the off reconcile must reinstall hooks.
## Suggested approach
Settle the transition deterministically once the settings write has finished, instead of relying on an unrelated caller to read the flag. For example expose a `settleIsolationTransition()` and call it from `settings.ts` after `updateSettings` succeeds. Keep the release-failure path fail-closed.
## Open questions
- Should a persist failure after a successful release also reopen (the stored flag is `false`), or stay fail-closed until restart as the current comment intends?
ELI5
Orca edits files that belong to your agent CLIs: their settings, their "trusted folders" lists and even their login files. This adds one switch, off by default, that tells Orca never to write anything outside its own data folder.
What Changed
~/.codex/config.toml,~/.cursor/projects/…,~/.copilot/config.jsonand~/.gemini/antigravity-cli/settings.json(on SSH remotes too)~/.codex/config.toml~/.claudesrc/main/agent-config-isolation.tsreads the newisolateExternalAgentConfigsetting through a live settings reader. The reader is registered right after the store is created, before account services and startup hook reconciliation run. It fails closed if the store can't be read.installManagedAgentHooks,applyAgentStatusHooksEnabled(true),installRemoteManagedAgentHooksensureRealHomeCodexHookState,promoteCodexRuntimeHookApprovalsToSystem,syncSystemConfigIntoManagedCodexHomemark*Trustedpresets andmarkRemoteAgentWorkspaceTrusted. Codex trust still goes to Orca's own runtimeconfig.toml, not to~/.codex.ClaudeRuntimeAuthSync.doSyncForCurrentSelectionisAgentStatusHooksEnabledreturns false while isolated, so every existing hooks-on check (PTY env, WSL relay, Codex preflight) follows without new branches.selectAccount(null)path, so a managed login isn't left in~/.claude. While isolated, selecting a managed account throws a clear error before anything is saved.~/.codex/auth.json. Blocking that would leave the user's own Codex login holding a rotated-out refresh token. It never changes which account is logged in.Why
People who manage agent config as code (dotfiles, generated
settings.json) can't use Orca today without it rewriting those files. The status-hooks switch, #19974 and #20691 cover hooks only. Trust presets, the Codex write-back and credential materialization have no off switch.Guarding each writer at its existing entry point keeps the diff small and the default path unchanged, because every gate is
=== true. Alternatives I considered:userData. It's broader, but it touches the shared write helpers and fails late, at write time.Linked Issue
Fixes #22892
Mitigates these for users who enable the setting, without changing default behaviour:
CLAUDE_CONFIG_DIRcodexstartup #22592: a duplicate[projects."…"]table in~/.codex/config.tomlstatusLinerewritten on launch~/.claude/settings.json. The opt-out is available; status-without-writes is not part of this PR.Related: #9963, #19974, #20691.
Visual Proof
Settings → Agents, captured headlessly from the E2E build (Linux).
Before (
main):After, default (off):
After, isolation on (status hooks shown as paused):
Testing
Automated tests:
src/main/agent-config-isolation.test.ts(10 tests):userDatais byte-identical. A negative control shows the same writers do write when not isolated.claude-account-service-account-selection.test.ts: selecting a managed account while isolated is rejected without persisting or syncing.tests/e2e/external-agent-config-isolation.spec.ts: launches the built app against a seeded, disposable HOME (viacreateElectronHomeIsolation) and triggers every trust preset. Isolated: no agent-config path changes. Control run: agent config does change.CI: PR Checks passed on my fork: typecheck, static analysis, all 8 unit shards (about 88.8k tests), changed E2E specs including the new one, localhost SSH E2E, and the Linux and Windows package jobs.
Manual (Linux, Fedora 44): a packaged AppImage run against throwaway HOMEs.
~/.claudeand~/.codexunchanged, and no~/.orca/agent-hooks.Not tested: macOS, native Windows, a live remote SSH host.
AI Disclosure
This change was produced with agentic coding. I directed Claude Code (Claude Opus 5.5) through the whole workflow: mapping the external write paths, planning, implementing, writing the unit and E2E tests, capturing the screenshots, and running verification. A separate AI security pass and an independent AI code-review pass checked the change. Their findings are addressed here: account selection while isolated, the Codex settings write-back path, coverage of remote hooks and Claude sync, and noting that a toggle mid-write lets that one write finish. I made the scope and design decisions and approved each step. The agent ran the manual AppImage checks on my machine.
Review
doSyncForCurrentSelectiongate.CLAUDE_CONFIG_DIR.client-settings-paramsis untouched).Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)