Skip to content

fix(codex): write folder trust only into the Codex home the launch runs on - #25801

Closed
brennanb2025 wants to merge 7 commits into
mainfrom
brennanb2025/codex-trust-follows-codex-home
Closed

brennanb2025 wants to merge 7 commits into
mainfrom
brennanb2025/codex-trust-follows-codex-home

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​336 $\color{#cf222e}{\Huge{\mathbf{−}}}$​30 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​306
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​109 $\color{#cf222e}{\Huge{\mathbf{−}}}$​56 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​53

ELI5

When Orca starts Codex in a folder, it first writes a "this folder is trusted" line into a Codex settings file, so Codex doesn't stop and ask. Orca was writing that line into your own ~/.codex/config.toml every time, even though the Codex Orca starts usually reads a different settings file that Orca owns. Your personal Codex settings kept changing for no reason you could see. Now Orca writes the line only into the settings file the Codex it is starting actually reads.

What Changed

The problem. On every fresh local Codex start (a terminal launch or a native chat), Orca added a [projects."<folder>"] trust_level = "trusted" entry to two files:

  • Orca's own shared Codex home under its app data, and
  • <HOME>/.codex/config.toml, your personal Codex config.

But the Codex that Orca starts normally runs with CODEX_HOME pointing at a home Orca picked: that shared home, or a per-account home when you choose a Codex account in Orca. That Codex never reads ~/.codex/config.toml, so the second write did nothing for it and only changed your own file. Over time your real config filled up with entries for every worktree Orca ever started Codex in, on every machine you use Orca on. Test setups that isolate CODEX_HOME but keep the real HOME wrote into the real file too.

The reverse was also broken: when you pick a Codex account, Orca never wrote trust into that account's home. The entry only reached it on a later launch, copied in from ~/.codex. So the launch that needed it could still stop at Codex's "Do you trust this folder?" question.

Before → after, as you experience it:

Launch Before After
Codex on Orca's shared home (the usual case) Your ~/.codex/config.toml gains an entry for the folder. Your ~/.codex/config.toml is not touched. Orca's own home gets the entry.
Codex on an account you picked in Orca Your ~/.codex/config.toml gains an entry; the account's home doesn't, so this launch can still ask. The account's home gets the entry, so this launch doesn't ask. Your ~/.codex/config.toml is not touched.
Codex on your own ~/.codex (no account picked, Orca running Codex on your real home) Entry in ~/.codex/config.toml. Same. That is the file this Codex reads.
Native (structured) Codex chat Trust written into the shared home and ~/.codex before Orca picked the chat's home. A new chat on an account still got it, copied in from ~/.codex, but a resumed chat moved back to another account's home could ask. Your ~/.codex/config.toml gained an entry every time. Trust goes to the home the chat runs on, including the home a resumed chat is moved back to. Your ~/.codex/config.toml is only touched when the chat runs on it.
SSH host Trust into CODEX_HOME (or ~/.codex) on the remote machine. Unchanged.
WSL Codex asks (Orca writes nothing). Unchanged.

What you may notice: a codex you type yourself, in a folder that only Orca trusted and under a different Codex home than the one Orca used there, now asks once, as Codex normally does. That covers your own terminal outside Orca, and also a plain Orca terminal after you switch Codex accounts in Orca. Agents Orca starts never ask, because each start writes trust into its own home. Entries Orca already wrote to your ~/.codex/config.toml stay where they are. They are identical to trust you accepted yourself, and removing them could take away trust you really gave.

Mechanism.

  • One rule decides which file a Codex launch reads: its CODEX_HOME, otherwise .codex in its home folder. It now lives in one place (launchedCodexConfigFile in src/main/execution-host-workspace-trust.ts). The SSH relay already used this rule and now calls the shared function.
  • The local trust step gets the Codex home that the launch will run on (codexHome on the trust launch context). Before, it only got the launch environment. On this machine that environment doesn't contain the home yet: the terminal provider adds CODEX_HOME after the trust step runs. The terminal spawn builders already hold the home they picked (selectedCodexHomePath), so they pass it on. null means Orca runs Codex on your own ~/.codex; then the file is .codex under the launch's home (HOME, USERPROFILE on Windows), exactly as on main and on SSH hosts.
  • Local targets are Orca's shared home (kept: it is Orca's own file) plus that one file. When the two are the same file it is written once. The lock order is the same as the hook installer's.
  • Native Codex chats now write trust after the chat's home is chosen, including when a resume moves it back to an older home. Each native-chat agent's registration can supply an optional step that runs once its home is final (afterAccountHomePinned); Codex uses it for the trust write, and the account-home lookup itself no longer writes anything.

Why

The trust entry is only useful in the file the launched Codex reads, so the target should come from the same input Codex uses: the home that launch runs on. Orca already decides that home before the trust step runs, so passing that decision along removes the guessing. It covers every launch path, and Orca's terminals and the SSH relay now follow the same rule.

How the ~/.codex write came about: when Codex trust writing was first added, Orca's Codex ran on ~/.codex, so that was the right file. When Orca moved its Codex onto its own home, the new home was added next to ~/.codex instead of replacing it. Since then the old write only did two indirect things. A per-account home got trust copied in from ~/.codex on a launch (this PR writes that home directly instead), and trust spread between Orca's homes through ~/.codex (the account-switch case above). When Orca refreshes its own homes from ~/.codex it keeps the trust entries already in each home, and it never copies them back into ~/.codex, so trust written straight into a home stays there.

Alternatives considered:

  • Read CODEX_HOME from the launch environment (the literal relay rule applied locally). This doesn't work on this machine. In the terminal path the environment doesn't have the final CODEX_HOME yet. And a CODEX_HOME you set yourself is not what Orca's Codex reads: Orca sends that case to its shared home. This version would have written your real file, or your custom home, while the launched Codex read neither.
  • Keep writing ~/.codex so your own Codex outside Orca also skips the question. That is exactly the unexplained change to your personal config this PR removes. The cost, one question in a folder only Orca ever trusted, is what Codex does by design.
  • Clean up entries already written. Not done. They can't be told apart from trust you granted yourself.

Related: #25184 stops Orca from running Codex on your real home when the home Codex itself would pick (the Windows profile folder, the macOS login home, an empty HOME) differs from the one Orca would write. With it, "no CODEX_HOME means ~/.codex" holds on every platform. Without it, the mismatch cases write trust where Codex doesn't look, so Codex asks; nothing extra is written. The two PRs touch no common files and can land in either order.

Linked Issue

None: found while investigating unexplained changes to ~/.codex/config.toml on several machines.

Visual Proof

N/A: no UI change. Proof of which files change is in the QA comment below (an isolated test setup, plus before/after hashes of the real config).

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • New src/main/agent-workspace-trust-codex-home.test.ts writes real files under a temporary HOME and a temporary app-data folder:

    • a per-account launch writes only that home and Orca's home, and ~/.codex/config.toml stays byte-identical;
    • a launch on Orca's home writes that file once;
    • a real-home launch writes Orca's home and ~/.codex;
    • a launch on another home never creates ~/.codex.
  • The shared rule is tested with an explicit home, a missing one, null and an empty string. Orca's home comes first and is listed once.

  • Both terminal spawn builders are tested to pass on the selected home. With a CODEX_HOME, the Codex target ignores the launch environment's HOME; without one it uses .codex under that HOME (USERPROFILE on Windows), else the user's home folder. The other agents still use the launch HOME.

  • Native chat create: trust goes to the selected home, to the moved-back home on a resume, and not at all on a replayed create. It is written after home selection.

  • The SSH relay still honours CODEX_HOME.

  • Each mechanism was removed in turn and its test went red.

  • Typecheck (node, web, cli) shows only the known missing-module errors from main. oxlint, the changed-code quality gate and React Doctor are clean.

Review

  • The kinds of launch checked: Codex on your real home, on Orca's shared home, on a picked account's home, with a CODEX_HOME you set in Orca's environment or agent settings, Orca running inside an Orca terminal, terminals hosted by Orca's background terminal process, native chats, WSL, and SSH.
  • Differences that are intended:
    • Trust is written only into homes that a Codex being started reads, not into every home Orca owns. Writing all of them on every launch would bring back the spreading the account-switch case relied on, with more file locks per launch.
    • A resumed native chat whose conversation lives in another Codex home is moved back to that home, and trust is now written there, because that is the home the chat runs on.
    • With no CODEX_HOME, the default home comes from the launch's HOME (USERPROFILE on Windows), as on main. Where Codex itself resolves home differently (the Windows profile folder, the macOS login home), fix(codex): never use Codex's default home when it isn't Orca's ~/.codex #25184 keeps Orca off that lane. Without fix(codex): never use Codex's default home when it isn't Orca's ~/.codex #25184 the effect is that Codex asks, and nothing extra is written.
  • Known gaps, unchanged by this PR:
    • WSL Codex terminals still ask.
    • A CODEX_HOME set somewhere Orca's startup-file check can't see (for example a sourced file or direnv) makes Codex read that home while Orca believes it runs on ~/.codex, so Codex asks.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Security: Orca writes less into a file it doesn't own. Cross-platform: path comparison uses the existing helper, which ignores case on Windows. SSH: unchanged behaviour, now through the shared function. Mobile: not affected. Performance: the same number of file writes or fewer.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Every local Codex launch wrote folder trust into two files: Orca's shared
mirror home and the user's own ~/.codex/config.toml (under the launch env's
HOME). It never wrote the home the launched Codex actually reads. A Codex
started on the mirror or on a per-account home therefore also changed the
user's real ~/.codex, which that Codex never reads, and a per-account home
only picked trust up through the mirror on some later launch.

Trust now follows the CODEX_HOME Orca gives the launch: Orca's mirror (kept,
it is Orca-owned) plus the one config the launched Codex reads, written once
when they are the same file. With no CODEX_HOME (the real-home lane) that is
~/.codex, the home the real-home hook lane uses. The terminal spawn builders
pass the selected Codex home they already hold; a structured Codex chat now
writes trust after its account home is chosen, so a resume trusts the home
its conversation lives in. The SSH relay uses the same one rule, unchanged.
…tructured trust runs from a pinned-home callback

With no CODEX_HOME, Codex reads .codex under the home the launch env names, so the local writer now uses the same home the relay does instead of homedir(). The shared structured create resolver no longer names Codex: the Codex branch passes a callback that writes trust once the chat's account home is final.
…-home

#25159 moved structured account-home resolution into per-agent registrations and put Codex's trust write inside resolveCodexAccountHomePath, before the home is picked or adopted. Registrations now get an optional afterAccountHomePinned hook, which the create resolver awaits once after the replay check with the final home (adopted or selected); a read never runs it. Codex supplies the trust write there; Claude supplies none.
The Codex registration's account-home resolver writes no trust for a launch or a read; its post-pin step writes into the home it is given, once, and Claude has none.
@brennanb2025
brennanb2025 marked this pull request as ready for review October 6, 2026 09:50
@brennanb2025

brennanb2025 commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Review and QA summary (head 961bba223e5)

The problem. Before Orca starts Codex, it writes a "this folder is trusted" entry so Codex doesn't stop and ask. The local writer always wrote that entry into your own ~/.codex/config.toml, even when the Codex being started runs on another home: Orca's own shared home, or a per-account home. That is why the real config kept gaining entries for worktrees on every machine, including from test setups that isolated CODEX_HOME. A per-account home, meanwhile, never got the entry itself.

What changes for you.

  • Orca writes trust only into the home the Codex being started reads, plus Orca's own shared home.
  • Your ~/.codex/config.toml changes only when Orca runs Codex on it.
  • Picking a Codex account now trusts that account's home on the launch that needs it.
  • A native chat's trust goes to the home that chat runs on, including the home a resumed chat is moved back to.
  • SSH hosts are unchanged. WSL is unchanged (Codex still asks there).
  • Possible new question: a codex you type yourself, in a folder that only Orca trusted and under a different Codex home (outside Orca, or in a plain Orca terminal after switching accounts), asks once. Agents Orca starts never ask.
  • Entries already in ~/.codex/config.toml are left alone.

Fixed during review.

Deferred (P3/nits; all pre-existing or fail safe, meaning Codex asks and nothing extra is written).

  • Where Codex resolves its home differently from Orca (the Windows profile folder vs USERPROFILE, the macOS login home, an empty HOME): fix(codex): never use Codex's default home when it isn't Orca's ~/.codex #25184 keeps Orca off that lane.
  • The SSH relay's Windows default home still comes from USERPROFILE.
  • A CODEX_HOME set somewhere Orca's startup-file check can't see (for example direnv or a sourced file).
  • WSL Codex terminals get no trust write.
  • No test links the trust write's home to the CODEX_HOME the terminal provider sets later.

Verified.

  • Two adversarial review rounds: terminal launch paths, file locks and platforms; native chats, tests and PR text.
  • An architecture challenger designed a fix from the issue alone, then compared it with this PR; it found no gaps.
  • A readiness checklist (SSH, crash and retry, security, performance, correctness, compatibility, cross-platform, code organization): PASS, no P0/P1.
  • Every mechanism was removed in turn and its test went red (28 removals across the rounds).
  • Typecheck shows only the known missing-module errors from main. Lint and the quality gates are clean.
  • CI on 961bba223e5: 39 passed, including static analysis/typecheck, packaging (macOS/Linux and Windows), unit tests (5 shards), relay integration, the e2e app build and SSH watcher-isolation e2e (4 shards), the SSH host matrices and persistence on six platforms. 13 were skipped by path filters. 4 failed, all main's known failure, not this PR's: linux_glibc_floor and linux_musl (both architectures) in the headless Node-server workflow fail one test, src/main/persistence/profile-state/profile-state-writer-stall.electron.test.ts, with spawn xvfb-run ENOENT. That Electron test should never run in the display-less container. Main fixed this after this PR's merge base in fix(ci): actually exclude Electron probes from the headless node-server lanes #26093 ("actually exclude Electron probes from the headless node-server lanes"), and the same jobs pass on main at 4077fb4a8de. This PR touches no persistence or CI files.
  • Windows high spec, isolated test setup: separate HOME, CODEX_HOME and app data; a stand-in codex; Codex started through the rig's own CLI, which goes through the desktop terminal spawn path.
    • Main (5f7c8483e9c): trust went to Orca's home and also created <test HOME>\.codex\config.toml with the same entry. That is the bug.
    • This PR (75f1cab73e2; later commits change comments, the native-chat path and merge main, and the terminal launch path tested here is unchanged by them): trust went only to Orca's home. <test HOME>\.codex was never created, and the isolated CODEX_HOME stayed byte-identical. A second worktree gave the same result. The stand-in saw CODEX_HOME = Orca's home on both.
    • The real C:\Users\neil\.codex\config.toml, hooks.json and .claude\settings.json were unchanged across 15 hash snapshots. ~/.claude.json changed once, after the test app had quit, while 14 live Claude processes were running on the box; it is not attributed to the test.

Not verified.

  • The desktop "New tab → Codex" click itself. No UI driver had usage on the Windows box: Grok was not signed in, Codex returned 503 re-auth, and three opencode models errored or hung. A later attempt from the laptop lost the box connection. The CLI launch above goes through the same desktop spawn path.
  • Native chats with a real codex app-server (unit tests only; locally several native-chat test files can't load because a package is missing from the shared install, and CI runs them).
  • SSH and WSL runs.
  • Linux and macOS live runs (unit tests only).
  • The macOS M4Air was overloaded (load average ~148), so QA ran on Windows.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 896e4c6e-28cb-4410-b89d-6fa009fadfc5
📥 Commits

Reviewing files that changed from the base of the PR and between 332081a and 961bba2.

📒 Files selected for processing (6)
  • src/main/codex/codex-trust-config-concurrent-launch.test.ts
  • src/main/runtime/orca-runtime-get-structured-agent-session-create-support.ts
  • src/main/runtime/orca-runtime-structured-agent-registration-seam.test.ts
  • src/main/runtime/orca-runtime-structured-agent-session-create-intent.test.ts
  • src/main/runtime/structured-agent-runtime-registrations-acp.test.ts
  • src/main/runtime/structured-agent-runtime-registrations.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Codex workspace trust now uses the launch’s selected Codex home to identify the launched config.toml. Trust config discovery returns the managed config and adds the launched config when the paths differ. Structured-session trust is applied through a post-pin hook, using the finalized account home and workspace path.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 961bb

No actionable issue is established for the changed Codex trust paths or session timing; the change is mergeable after normal checks.

🚥 Pre-merge checks | ✅ 3 | ❌ 1 | ❓ 1

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 46.15% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 23 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description is detailed and covers the template’s main sections, including the change, rationale, testing, visual proof, review, and checklist. It says there is no linked issue, but the template m… Confirm whether the author is a maintainer. If not, link the issue this PR addresses; if the author is a maintainer, state that the maintainer exception applies.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: Codex folder trust is written to the home used by the launch. It is concise and specific.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and covers the template’s main sections, including the change, rationale, testing, visual proof, review, and checklist. It says there is no linked issue, but the template makes that requirement conditional on contributor status, which is not provided.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 22c85d82-b6a4-48fe-bea2-61f96ed479d3
📥 Commits

Reviewing files that changed from the base of the PR and between 4de9f9f and 332081a.

📒 Files selected for processing (22)
  • src/main/agent-trust-presets.test.ts
  • src/main/agent-trust-presets.ts
  • src/main/agent-workspace-trust-codex-home.test.ts
  • src/main/agent-workspace-trust-guard-failure.test.ts
  • src/main/agent-workspace-trust-spawn.test.ts
  • src/main/agent-workspace-trust-spawn.ts
  • src/main/agent-workspace-trust.test.ts
  • src/main/agent-workspace-trust.ts
  • src/main/codex/codex-home-paths.test.ts
  • src/main/codex/codex-home-paths.ts
  • src/main/codex/codex-trust-config-concurrent-launch.test.ts
  • src/main/execution-host-workspace-trust.test.ts
  • src/main/execution-host-workspace-trust.ts
  • src/main/ipc/pty/ipc/spawn-options.ts
  • src/main/ipc/pty/runtime/spawn-options.ts
  • src/main/ipc/pty/spawn-options-agent-workspace-trust.test.ts
  • src/main/runtime/orca-runtime-get-structured-agent-session-create-support.ts
  • src/main/runtime/orca-runtime-structured-agent-registration-seam.test.ts
  • src/main/runtime/orca-runtime-structured-agent-session-create-intent.test.ts
  • src/main/runtime/structured-agent-runtime-registrations.ts
  • src/main/startup/codex-launch-during-real-home-grant.test.ts
  • src/relay/agent-workspace-trust-spawn.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Comment on lines 132 to 138
claudeAuth: ctx.claudeAuth,
wslDistro: ctx.expectedWslDistro,
connectionId: args.connectionId ?? null,
codexHome: ctx.selectedCodexHomePath,
spawnOptions: ctx.spawnOptions
})
if (trustWrite) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

rg -n 'getSelectedCodexHomePath|getCompatibleSelectedCodexHomePath|codexHomePathOverride' src/main/ipc/pty src/main/providers

Repository: stablyai/orca

Length of output: 4011


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- callback definitions and bindings ---'
rg -n 'getSelectedCodexHomePath|GetSelectedCodexHomePath|codexSelectionTarget' src/main
printf '%s\n' '--- selection and compatibility implementation ---'
nl -ba src/main/ipc/pty/host-env/codex-home.ts | sed -n '1,125p'
printf '%s\n' '--- callback binding candidates ---'
rg -n 'getSelectedCodexHomePath\s*[:=]|getSelectedCodexHomePath,' src/main --glob '!ipc/pty/**'
printf '%s\n' '--- IPC selection flow ---'
nl -ba src/main/ipc/pty/ipc/spawn-env-codex.ts | sed -n '45,105p'
nl -ba src/main/ipc/pty/ipc/spawn-options.ts | sed -n '80,170p'
printf '%s\n' '--- runtime selection flow ---'
nl -ba src/main/ipc/pty/runtime/spawn-preflight.ts | sed -n '175,235p'
nl -ba src/main/ipc/pty/runtime/spawn-options.ts | sed -n '45,175p'
printf '%s\n' '--- local provider flow ---'
nl -ba src/main/ipc/pty/provider/local-configure.ts | sed -n '38,75p'
nl -ba src/main/providers/local-pty-spawn-environment.ts | sed -n '1,100p'
printf '%s\n' '--- host environment CODEX_HOME policy ---'
nl -ba src/main/ipc/pty/host-env/assembly.ts | sed -n '210,265p'
nl -ba src/main/ipc/pty/host-env/codex-home.ts | sed -n '1,95p'
printf '%s\n' '--- callback type and spawn entrypoint types ---'
nl -ba src/main/ipc/pty/host-env/types.ts | sed -n '35,65p'
nl -ba src/main/ipc/pty/ipc/spawn-types.ts | sed -n '65,100p'
nl -ba src/main/ipc/pty/runtime/controller-deps.ts | sed -n '60,90p'

Repository: stablyai/orca

Length of output: 42149


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- full source callback bindings ---'
rg -n 'getSelectedCodexHomePath|GetSelectedCodexHomePath' src
printf '%s\n' '--- runtime preflight and trust builder ---'
nl -ba src/main/ipc/pty/runtime/spawn-preflight.ts | sed -n '115,230p'
nl -ba src/main/ipc/pty/runtime/spawn-options.ts | sed -n '45,175p'
printf '%s\n' '--- IPC selected-home environment setup ---'
nl -ba src/main/ipc/pty/ipc/spawn-env-codex.ts | sed -n '20,105p'
nl -ba src/main/ipc/pty/ipc/spawn-env.ts | sed -n '170,210p'
printf '%s\n' '--- callback forwarding and local provider construction ---'
nl -ba src/main/ipc/pty/register-handlers.ts | sed -n '55,80p'
nl -ba src/main/ipc/pty/register-handlers.ts | sed -n '135,165p'
nl -ba src/main/window/attach-main-window-services.ts | sed -n '45,100p'
nl -ba src/main/ipc/pty-ipc-spawn-drivers.ts | sed -n '20,72p'
printf '%s\n' '--- full relevant host env option computation ---'
rg -n 'stripInheritedOrcaCodexHome|selectedCodexHomePath|skipCodexHomeEnv' src/main/ipc/pty/host-env

Repository: stablyai/orca

Length of output: 33648


🏁 Script executed:

#!/bin/bash
BASE=4de9f9f85a858c711a1513852407354337e1bd36
HEAD=332081ae23910d26ac59e8c73da9ae3af26a81b0
printf '%s\n' '--- trust implementation and config path helper ---'
nl -ba src/main/agent-workspace-trust.ts | sed -n '1,125p'
nl -ba src/main/execution-host-workspace-trust.ts | sed -n '1,85p'
rg -n 'launchedCodexConfigFile' src/main
printf '%s\n' '--- production attach callsites ---'
rg -n 'attachMainWindowServices\(' src
printf '%s\n' '--- callback and selection-provider references ---'
rg -n 'selectedCodexHome|SelectedCodexHome|resolveCodexPaneLaunchAccount|getSystemCodexHomePath|real.home' src/main
printf '%s\n' '--- focused PR diff ---'
git diff --unified=5 "$BASE" "$HEAD" -- src/main/ipc/pty/ipc/spawn-options.ts src/main/ipc/pty/runtime/spawn-options.ts src/main/agent-workspace-trust.ts src/main/execution-host-workspace-trust.ts
printf '%s\n' '--- current full trust call locations ---'
rg -n -C 8 'applyAgentWorkspaceTrustToSpawn' src/main/ipc/pty/ipc/spawn-options.ts src/main/ipc/pty/runtime/spawn-options.ts

Repository: stablyai/orca

Length of output: 41489


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- runtime spawn state initialization and call flow ---'
nl -ba src/main/ipc/pty/runtime/spawn-state.ts | sed -n '1,185p'
rg -n 'buildRuntimePtySpawnOptions|preflightRuntimePtySpawn|RuntimePtySpawnState' src/main/ipc/pty/runtime
printf '%s\n' '--- trust dispatch and spawn fields ---'
nl -ba src/main/agent-workspace-trust-spawn.ts | sed -n '1,115p'
printf '%s\n' '--- local provider final environment enforcement ---'
rg -n -C 5 'buildLocalPtySpawnEnvironment|enforceLocalPtySpawnEnvironmentOverrides|spawn\.envToDelete' src/main/providers src/main/ipc/pty/provider
nl -ba src/main/ipc/pty/provider/local-configure.ts | sed -n '52,115p'
printf '%s\n' '--- real-home host routing test ---'
nl -ba src/main/ipc/pty-spawn-env-codex-home-routing.test.ts | sed -n '320,380p'
printf '%s\n' '--- production startup callback forwarding ---'
nl -ba src/main/startup/main-window-core-services.ts | sed -n '90,130p'
printf '%s\n' '--- callback source candidates by behavior ---'
rg -n 'resolveCodexPaneLaunchAccount|resolveRuntime.*Codex|realHome.*Codex|host.*real-home|homeRoute.*real-home' src/main/startup src/main/codex-accounts src/main/codex

Repository: stablyai/orca

Length of output: 38856


🏁 Script executed:

#!/bin/bash
BASE=4de9f9f85a858c711a1513852407354337e1bd36
printf '%s\n' '--- local Codex trust config helper contract ---'
rg -n 'getLocalCodexTrustConfigFiles' src/main/codex src/main
nl -ba src/main/codex/codex-home-paths.ts | sed -n '1,155p'
printf '%s\n' '--- prior trust call and related PR test changes ---'
git show "$BASE:src/main/agent-workspace-trust.ts" | nl -ba | sed -n '55,100p'
git diff --unified=4 "$BASE" 332081ae23910d26ac59e8c73da9ae3af26a81b0 -- src/main/agent-workspace-trust.test.ts src/main/execution-host-workspace-trust.test.ts
printf '%s\n' '--- callback implementation and launch wiring ---'
rg -n 'prepareCodexRuntimeHomeForLaunch' src/main
nl -ba src/main/startup/codex-launch-preparation.ts | sed -n '1,150p'
printf '%s\n' '--- runtime launch env/deletion flow ---'
nl -ba src/main/ipc/pty/runtime/spawn.ts | sed -n '50,110p'
nl -ba src/main/ipc/pty/runtime/spawn-preflight.ts | sed -n '232,295p'
nl -ba src/main/ipc/pty/runtime/spawn-options.ts | sed -n '74,105p'
printf '%s\n' '--- local provider inherited env and final env ---'
nl -ba src/main/providers/local-pty-spawn-environment.ts | sed -n '19,50p'
nl -ba src/main/providers/local-pty-spawn.ts | sed -n '66,90p'
printf '%s\n' '--- focused trust-related tests ---'
rg -n -C 4 'codexHome|CODEX_HOME|launchedCodexConfigFile' src/main/agent-workspace-trust.test.ts src/main/execution-host-workspace-trust.test.ts

Repository: stablyai/orca

Length of output: 37888


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- runtime-home launch selection definitions ---'
rg -n 'prepareForCodexLaunchAsync|isHostSystemDefaultRealHomeSelected|hasCustomCodexHomeOverrideForLaunch' src/main/codex-accounts src/main/codex
nl -ba src/main/codex-accounts/runtime-home-service-launch.ts | sed -n '1,115p'
printf '%s\n' '--- owning runtime-home service implementation ---'
rg -n -C 10 'prepareForCodexLaunchAsync|isHostSystemDefaultRealHomeSelected' src/main/codex-accounts --glob '*.ts' --glob '!*.test.ts'
printf '%s\n' '--- real-home selection and custom CODEX_HOME tests ---'
rg -n -C 5 'prepareForCodexLaunchAsync|isHostSystemDefaultRealHomeSelected|CODEX_HOME|real-home' src/main/codex-accounts/runtime-home-service*test.ts src/main/startup/codex-launch-*.test.ts

Repository: stablyai/orca

Length of output: 42688


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- exact custom CODEX_HOME detector ---'
nl -ba src/main/codex/codex-real-home-path.ts | sed -n '1,65p'
printf '%s\n' '--- detector behavior tests ---'
nl -ba src/main/codex/codex-real-home-path.test.ts | sed -n '35,100p'

Repository: stablyai/orca

Length of output: 5492


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- launch-env value semantics ---'
nl -ba src/main/codex/codex-real-home-path.ts | sed -n '59,105p'
printf '%s\n' '--- runtime controller registration and spawn callers ---'
rg -n 'spawnPtyFromRuntimeController|registerHeadlessRuntime|createPtyRuntimeController|getSelectedCodexHomePath' src/main --glob '*.ts'
nl -ba src/main/ipc/pty/register-headless-runtime.ts | sed -n '1,65p'
nl -ba src/main/startup/main-process-runtime-service.ts | sed -n '125,155p'
nl -ba src/main/startup/main-process-runtime-service.ts | sed -n '185,215p'
printf '%s\n' '--- runtime route/controller interface ---'
nl -ba src/main/ipc/pty/runtime/controller-deps.ts | sed -n '65,82p'
nl -ba src/main/ipc/pty/runtime/spawn-state.ts | sed -n '84,102p'
nl -ba src/main/ipc/pty/runtime/spawn-preflight.ts | sed -n '175,205p'

Repository: stablyai/orca

Length of output: 12000


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- headless runtime registration callers ---'
rg -n 'registerHeadlessPtyRuntime\(' .
printf '%s\n' '--- runtime controller construction and callback wiring ---'
rg -n 'createPtyRuntimeController|PtyRuntimeController\(|getSelectedCodexHomePath\s*:' src/main
nl -ba src/main/ipc/pty/runtime/controller.ts | sed -n '1,95p'
nl -ba src/main/ipc/pty/register-handlers.ts | sed -n '220,275p'
printf '%s\n' '--- runtime-deps construction candidates ---'
rg -n 'getSelectedCodexHomePath' src/main --glob '*.ts' --glob '!*.test.ts'

Repository: stablyai/orca

Length of output: 12284


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- complete selected-home readiness resolution ---'
nl -ba src/main/ipc/pty/host-env/codex-home.ts | sed -n '99,195p'
printf '%s\n' '--- managed-auth readiness null-home contract ---'
rg -n -C 8 'isCodexHomeAuthReadyForLaunch|waitForManagedCodexAuthReady' src/main/codex-accounts/managed-codex-auth-readiness.ts

Repository: stablyai/orca

Length of output: 4942


🏁 Script executed:

#!/bin/bash
printf '%s\n' '--- inherited and explicit child-env merge ---'
rg -n 'function mergeGitConfigEnvProtocol|export function mergeGitConfigEnvProtocol' src/shared
nl -ba src/shared/git-credential-prompt-env.ts | sed -n '1,100p'
printf '%s\n' '--- null-selection local host-env preservation branch ---'
nl -ba src/main/ipc/pty/host-env/codex-home.ts | sed -n '41,64p'
nl -ba src/main/ipc/pty/host-env/assembly.ts | sed -n '229,256p'
printf '%s\n' '--- runtime local-provider selection override handoff ---'
nl -ba src/main/ipc/pty/runtime/spawn-options.ts | sed -n '53,65p'
nl -ba src/main/ipc/pty/provider/local-configure.ts | sed -n '52,91p'

Repository: stablyai/orca

Length of output: 9882


Resolve workspace trust against the effective child CODEX_HOME.

For a fresh local runtime spawn on the host real-home lane, an overridden HOME and an inherited, unmarked CODEX_HOME equal to the native ~/.codex path can produce a null selection. The local provider preserves that inherited CODEX_HOME, but trust writes to <launch HOME>/.codex/config.toml. The launched Codex reads <CODEX_HOME>/config.toml and can miss the trust entry. Resolve the effective child CODEX_HOME once at the shared trust boundary, honoring inherited environment values and deletions; both builders can use that correction.

…2025/codex-trust-follows-codex-home

# Conflicts:
#	src/main/runtime/orca-runtime-get-structured-agent-session-create-support.ts
#	src/main/runtime/orca-runtime-structured-agent-session-create-intent.test.ts
#	src/main/startup/codex-launch-during-real-home-grant.test.ts
@brennanb2025

Copy link
Copy Markdown
Contributor Author

Closing: parked since 10-07 and now conflicting with main; not being pursued.

@brennanb2025
brennanb2025 deleted the brennanb2025/codex-trust-follows-codex-home branch October 12, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant