fix: make Codex MCP credential inheritance explicit#10
Open
kbentonferguson wants to merge 2 commits into
Open
Conversation
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
--env,--inherit-env,--env-file,--map-env, and--force-env--force-envis passed--envonly when safe and a managed private wrapper/env file otherwise$CODEX_HOME/auth.jsonbefore falling back to~/.codex/auth.jsonWhy
Puppetmaster Codex MCP installs currently depend on whatever environment the MCP host happens to launch with. On Codex, that can silently select the wrong auth context: a user may have an API-key Codex home available, but the MCP server falls back to default
codexand~/.codex/auth.json, hitting ChatGPT/Codex plan usage limits instead of the intended billing path.This makes credential inheritance explicit, auditable, and provider-shaped. Puppetmaster does not inherit the full parent environment and does not decide a global billing method; users opt specific provider variables into the MCP server environment, including mapping local names into provider-canonical names like
CODEX_HOME.Tests
python3 -m py_compile puppetmaster/installers.py puppetmaster/cli.py puppetmaster/diagnostics.py puppetmaster/platform_billing.py puppetmaster/mcp_server.py puppetmaster/redaction.py tests/test_puppetmaster.pypython3 -m pytest tests/test_puppetmaster.py -q -k 'install_codex or uninstall_codex or resolve_mcp_env or codex_billing or doctor or adapter_status or billing or mcp_server'python3 -m pytest tests/test_puppetmaster.py -qpython3 -m puppetmaster install-codex-mcp --dry-run --env-file ~/.config/puppetmaster/env.zshpython3 -m puppetmaster install-codex-mcp --helpCODEX_HOME=<api-key-codex-home> python3 -m puppetmaster doctor --json