Conversation
| fn config_path() -> PathBuf { | ||
| home_dir().join(".codex").join("config.toml") | ||
| } |
There was a problem hiding this comment.
🟡 CodexInstaller::config_path() ignores CODEX_HOME, mismatching CodexPreset::codex_home_dir()
The CodexInstaller always resolves the Codex config to ~/.codex/config.toml via home_dir().join(".codex"), but CodexPreset::codex_home_dir() in src/commands/checkpoint_agent/agent_presets.rs:771-781 respects the CODEX_HOME environment variable. When a user sets CODEX_HOME to a non-default location (e.g. /opt/codex), the installer writes the notify hook to ~/.codex/config.toml, while Codex itself reads its config from $CODEX_HOME/config.toml. The hooks silently fail to activate.
Root Cause
CodexInstaller::config_path() at src/mdm/agents/codex.rs:12-13 is:
fn config_path() -> PathBuf {
home_dir().join(".codex").join("config.toml")
}But CodexPreset::codex_home_dir() at src/commands/checkpoint_agent/agent_presets.rs:771-781 is:
pub fn codex_home_dir() -> PathBuf {
if let Ok(codex_home) = env::var("CODEX_HOME")
&& !codex_home.trim().is_empty()
{
return PathBuf::from(codex_home);
}
dirs::home_dir()
.unwrap_or_else(|| PathBuf::from("~"))
.join(".codex")
}The check_hooks, install_hooks, and uninstall_hooks methods all use the hardcoded config_path(), so when CODEX_HOME is set, the installer reads/writes the wrong file. Install reports success but Codex never sees the hook.
Impact: Users who override CODEX_HOME will have hooks installed to the wrong location. install-hooks appears to succeed, but checkpoints never fire.
| fn config_path() -> PathBuf { | |
| home_dir().join(".codex").join("config.toml") | |
| } | |
| fn config_path() -> PathBuf { | |
| let codex_home = if let Ok(codex_home) = std::env::var("CODEX_HOME") | |
| && !codex_home.trim().is_empty() | |
| { | |
| PathBuf::from(codex_home) | |
| } else { | |
| home_dir().join(".codex") | |
| }; | |
| codex_home.join("config.toml") | |
| } | |
Was this helpful? React with 👍 or 👎 to provide feedback.
To test, please use codex version >=
npm i -g @openai/codex@0.99.0-alpha.24Fixes #501