Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/dotagents/src/targets/definitions/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("extractCodexHeaders", () => {
"X-Api-Key": "${GOOGLE_API_KEY}",
});
expect(httpHeaders).toBeUndefined();
expect(envHttpHeaders).toEqual({ GOOGLE_API_KEY: "X-Api-Key" });
expect(envHttpHeaders).toEqual({ "X-Api-Key": "GOOGLE_API_KEY" });
});

it("keeps static values in httpHeaders", () => {
Expand All @@ -80,7 +80,7 @@ describe("extractCodexHeaders", () => {
Authorization: "Bearer tok",
"X-Mixed": "prefix ${VAR} suffix",
});
expect(envHttpHeaders).toEqual({ API_KEY: "X-Api-Key" });
expect(envHttpHeaders).toEqual({ "X-Api-Key": "API_KEY" });
expect(httpHeaders).toEqual({
Authorization: "Bearer tok",
"X-Mixed": "prefix ${VAR} suffix",
Expand Down
4 changes: 2 additions & 2 deletions packages/dotagents/src/targets/definitions/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function interpolateHeaders(

/**
* Split headers for Codex's model: pure `${VAR}` refs go to `envHttpHeaders`
* (mapping env var name to header name), everything else stays in `httpHeaders`.
* (mapping header name to env var name), everything else stays in `httpHeaders`.
* Mixed values like `"Bearer ${TOKEN}"` can't be represented in Codex's
* env_http_headers format and fall through as literal strings in httpHeaders.
*/
Expand All @@ -60,7 +60,7 @@ export function extractCodexHeaders(
for (const [key, value] of Object.entries(headers)) {
const match = pureRefRe.exec(value);
if (match) {
(envHttpHeaders ??= {})[match[1]!] = key;
(envHttpHeaders ??= {})[key] = match[1]!;
} else {
(httpHeaders ??= {})[key] = value;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/dotagents/src/targets/mcp-writer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ describe("writeMcpConfigs", () => {
const content = parseTomlObject(raw);
expect(childObject(content, "mcp_servers")["authed-api"]).toEqual({
url: "https://${API_HOST}/mcp",
// Pure ref: X-Api-Key = "${API_KEY}" → env_http_headers.API_KEY = "X-Api-Key"
env_http_headers: { API_KEY: "X-Api-Key" },
// Pure ref: X-Api-Key = "${API_KEY}" → env_http_headers.X-Api-Key = "API_KEY"
env_http_headers: { "X-Api-Key": "API_KEY" },
// Mixed ref stays as literal in http_headers
http_headers: { Authorization: "Bearer ${TOKEN}" },
});
Expand Down
Loading