fix(codex): create CODEX_HOME before pinning it in the app-server env#39
Merged
Conversation
dmorosanu
requested review from
akshaylive,
bai-uipath,
tmatup and
uipreliga
as code owners
July 22, 2026 08:57
|
Claude finished @dmorosanu's task in 1m 23s —— View job Code Review in Progress
|
MarinRzv
approved these changes
Jul 22, 2026
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.

Problem
Every codex run with mocks configured on POSIX fails at startup since #26:
#26 pins
CODEX_HOMEin the app-server env (so codex state does not follow the redirected login-shellHOME). The codex binary treats an explicitly setCODEX_HOMEstrictly: it hard-errors when the path does not exist, whereas with the env var unset it materializes the~/.codexdefault itself. On runners that auth viaCODEX_API_KEY(never rancodex login),~/.codexdoes not exist, so the app-server dies at startup. Dev machines have~/.codex, unit tests pointedCODEX_HOMEat existing tmp dirs, and Windows never enters the login-shell path - which is why nothing caught it.Fix
Create the resolved dir (
mkdir(parents=True, exist_ok=True)) before pinning it - mirrors the binary's own default-dir behavior, idempotent acrossstart()retries.Validation
test_build_codex_env_creates_missing_codex_home(fails on main, passes here).codex app-serverwithCODEX_HOMEpointing at a nonexistent dir exits 1 with the exact error above; with the dir pre-created it starts cleanly.test_sandbox.py, also failing on main); ruff format/check and pyright clean.