Skip to content

Codex env_http_headers reverses header names and environment variable names #171

Description

@mishamilovidov

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

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions