fix(tests): isolate Codex home from user state#1150
Open
aaiyer wants to merge 1 commit into
Open
Conversation
Signed-off-by: Anand Aiyer <anand@aiyer.com>
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.
What does this PR do?
Completes the test-state isolation added in #1067. The runner replaced HOME and cleared CBM_CACHE_DIR, but it still inherited the invoking process's CODEX_HOME. When that directory existed, CLI fixtures detected the developer's real Codex installation and repeatedly installed and uninstalled MCP config, AGENTS.md content, skills, and Scout/Verify/Auditor profiles there.
A sentinel run on exact upstream/main e678b2b reproduced thousands of accesses and explicit write syscalls under the inherited CODEX_HOME, left an extra skills directory, and failed the install-plan no-mutation fixture because the inherited override shadowed its temporary .codex directory.
Fix
Worker and socket-probe modes still exit before normal suite setup, as before.
Validation
Local CI lint was attempted but cppcheck was unavailable; clang-format and clang-tidy are also not installed in this environment. GitHub CI remains the lint authority.
Coordination
#1149 overlaps the same install-plan fallback test for a separate fixture-lifetime issue. Whichever PR lands second will need to rebase and preserve both intents: free the receipt JSON on every validation-failure path, and explicitly isolate CODEX_HOME while exercising the fallback path.
Scope
Only tests/test_main.c and tests/test_cli.c change. There is no production behavior or dependency change.