Skip to content

bug: codex module ignores CODEX_HOME when writing configuration #1157

Description

@Edd88-pixel

Current Behavior

The coder-labs/codex module writes its configuration to $HOME/.codex/config.toml, even when CODEX_HOME points to another directory.

Codex reads its user configuration from $CODEX_HOME/config.toml. As a result, the module can finish successfully while writing settings that the CLI does not use. This affects workspaces that store Codex state in a custom or persistent directory: the module's model settings, MCP servers, trusted projects and AI Gateway configuration are written to the wrong location.

Steps to Reproduce

  1. Set CODEX_HOME=/home/coder/state/codex in the environment used by both the module's install script and the Codex CLI.
  2. Create that directory and a config.toml containing model_reasoning_effort = "high".
  3. Configure the module with base_config_toml = "model_reasoning_effort = \"medium\"" and start the workspace.
  4. Check both configuration files: $HOME/.codex/config.toml contains the module's medium setting, while $CODEX_HOME/config.toml still contains high.

Expected Behavior

The module should write its configuration under CODEX_HOME when it is set to a non-empty value, and use $HOME/.codex otherwise.

Currently, populate_config_toml() hardcodes the default path rather than following Codex's configuration directory.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions