fix(codex): share the user's global AGENTS.md into the managed Codex runtime home#7927
Open
TopGrd wants to merge 1 commit into
Open
fix(codex): share the user's global AGENTS.md into the managed Codex runtime home#7927TopGrd wants to merge 1 commit into
TopGrd wants to merge 1 commit into
Conversation
Contributor
📝 WalkthroughWalkthroughThe list of system Codex resource entries synced into the managed Codex home now includes AGENTS.md, with comments describing that it is sourced from the system Codex home's AGENTS.md and shared into managed home runtimes. A corresponding test was added that creates a system AGENTS.md file, invokes the sync function, and verifies that the resulting runtime AGENTS.md has matching content and is linked (via symbolic link or junction) to the system source file when linking is supported. 🚥 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 |
0c65d36 to
5592403
Compare
…runtime home Orca launches Codex with CODEX_HOME pointed at its managed runtime home, which shares skills/hooks/plugins/themes/prompts back to ~/.codex but not AGENTS.md. Codex reads global user instructions from $CODEX_HOME/AGENTS.md, so every Codex session launched inside Orca silently loses the user's global instructions. Add AGENTS.md to CODEX_SYSTEM_RESOURCE_ENTRIES so the existing link-or-copy sync covers it, with a regression test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5592403 to
4de18fe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Codex sessions launched inside Orca silently ignore the user's global
~/.codex/AGENTS.md. Orca pointsCODEX_HOMEat its managed runtime home and mirrorsskills/,hooks/,plugins/,plugin-state/,profile-v2/,themes/, andprompts/back to~/.codex— but notAGENTS.md, which is where Codex reads global user instructions from. This PR addsAGENTS.mdtoCODEX_SYSTEM_RESOURCE_ENTRIESso managed Codex sessions honor the user's global instructions again, plus a regression test and a docstring for the sync entry point.Reproduction (A/B, macOS, Orca 1.4.124, codex-cli 0.143.0). With a global
~/.codex/AGENTS.mdpresent, run in an empty directory (no project AGENTS.md):CODEX_HOME)noneCODEX_HOME=~/.codexManually symlinking
~/.codex/AGENTS.mdinto the managed home flips the first case to the correct result, confirming the missing share is the entire cause.Screenshots
No visual change.
Testing
pnpm lint— fails on a cleanmaincheckout with a pre-existing error unrelated to this PR (src/main/ipc/notification-authorization-status.ts:76switch-exhaustiveness-check);oxlinton the two files touched here reports no issuespnpm typecheck— passed (all three tsconfigs)pnpm test— the suites covering this change pass:codex-home-paths.test.ts7/7 andruntime-home-service.test.ts83/83. The full runner aborts in my sandbox atensure-native-runtime(Orca's patched node-pty build unavailable there) before vitest starts — deferring the full suite to CIpnpm build:desktop— passed;build:nativeblocked by the same sandbox limitation as abovemirrors the global AGENTS.md into the managed runtime home) that fails without the fixAI Review Report
Reviewed the change against the existing link-or-copy semantics of
linkSystemCodexResource:AGENTS.mdin the runtime home is not overwritten (existsSyncshort-circuit); an already-correct symlink is a no-op (targetAlreadyPointsToSource); deleting~/.codex/AGENTS.mdlater removes only entries the sync can prove it owns (link-target match or copy marker).junctiononly applies to directories); on Windows, file symlinks can fail outside developer mode and fall back to the ownership-marked copy path (cpSynchandles files), refreshing on later syncs — identical to how the existing file entryprofile-v2behaves. Paths are built withpath.join; no shell, shortcuts, labels, or renderer code involved.AGENTS.mdin the runtime home — it is respected and never overwritten.Security Audit
auth.json/config.toml/hooks.jsonremain private to the managed home — the auth isolation discussed in [Bug]: Orca's privateCODEX_HOMEcauses a Codex auth-revocation war with the user's~/.codex#5370 is untouched.~/.codexand Orca's userData dir). The sync removes only provably-owned entries, so it cannot clobber unrelated user files.AGENTS.mdis user-authored instructions by design; sharing the user's own file into the user's own managed home introduces no new trust boundary.Notes
AGENTS.mdinto the managed home are unaffected: the sync detects the identical link target and no-ops.skills) already use; this PR only extends the entry list consumed by that shared mechanism.🤖 Generated with Claude Code