Summary
The Codex target writes env_http_headers entries in the wrong direction.
Codex expects each HTTP header name as a key. Its value must be the name of an environment variable.
Reproduction
Add an HTTP MCP server with a symbolic header value:
[[mcp]]
name = "example"
url = "https://example.test/mcp"
[mcp.headers]
X-Api-Key = "${API_KEY}"
Run dotagents install, then inspect the generated Codex configuration.
Actual result
DotAgents maps the environment variable name to the HTTP header name:
env_http_headers.API_KEY = "X-Api-Key"
Codex interprets API_KEY as the HTTP header name and X-Api-Key as the environment variable name. Authentication then fails.
Expected result
DotAgents must map the HTTP header name to the environment variable name:
env_http_headers.X-Api-Key = "API_KEY"
Implementation notes
The affected helper is extractCodexHeaders in packages/dotagents/src/targets/definitions/helpers.ts.
Focused tests exist in:
packages/dotagents/src/targets/definitions/helpers.test.ts
packages/dotagents/src/targets/mcp-writer.test.ts
This problem is related to #158 because both defects affect symbolic environment references in Codex configuration. Issue 158 covers stdio env_vars. This issue covers HTTP env_http_headers and uses a different code path.
Environment
- DotAgents 3.0.1
- Codex 0.147.0 and 0.149.0
Summary
The Codex target writes
env_http_headersentries in the wrong direction.Codex expects each HTTP header name as a key. Its value must be the name of an environment variable.
Reproduction
Add an HTTP MCP server with a symbolic header value:
Run
dotagents install, then inspect the generated Codex configuration.Actual result
DotAgents maps the environment variable name to the HTTP header name:
Codex interprets
API_KEYas the HTTP header name andX-Api-Keyas the environment variable name. Authentication then fails.Expected result
DotAgents must map the HTTP header name to the environment variable name:
Implementation notes
The affected helper is
extractCodexHeadersinpackages/dotagents/src/targets/definitions/helpers.ts.Focused tests exist in:
packages/dotagents/src/targets/definitions/helpers.test.tspackages/dotagents/src/targets/mcp-writer.test.tsThis problem is related to #158 because both defects affect symbolic environment references in Codex configuration. Issue 158 covers stdio
env_vars. This issue covers HTTPenv_http_headersand uses a different code path.Environment