Skip to content

fix(coder-labs/modules/codex): rename AI Gateway session token env to OPENAI_ prefix#935

Merged
matifali merged 2 commits into
mainfrom
matifali/codex-rename-session-token-env
Jun 26, 2026
Merged

fix(coder-labs/modules/codex): rename AI Gateway session token env to OPENAI_ prefix#935
matifali merged 2 commits into
mainfrom
matifali/codex-rename-session-token-env

Conversation

@matifali

@matifali matifali commented Jun 26, 2026

Copy link
Copy Markdown
Member

Problem

Omnigent's native Codex bridge runs Codex in a filtered subprocess environment that strips env vars not prefixed with OPENAI_. The current CODER_AIBRIDGE_SESSION_TOKEN env var gets dropped, breaking AI Gateway authentication when Codex runs through Omnigent.

Discovered while working on the Omnigent module in #925 — the workaround was a sed hack in post_install_script to rewrite the env_key in config.toml at runtime. This fix eliminates that workaround.

Fix

Rename the env var from CODER_AIBRIDGE_SESSION_TOKEN to OPENAI_CODER_AIGATEWAY_SESSION_TOKEN at the source, so it survives Omnigent's env filtering without any workarounds.

Changes

File Change
main.tf coder_env name + env_key in aibridge_config
main.tftest.hcl Updated assertion to match new env var name
main.test.ts Updated custom config test to use new env var name
README.md Version bump 5.2.05.2.1

Module Information

Path: registry/coder-labs/modules/codex
New version: v5.2.1

Breaking change: [ ] Yes [x] No

🤖 This PR was created with the help of Coder Agents, and needs a human review. 🧑💻

matifali added 2 commits June 27, 2026 03:04
…efix

Rename CODER_AIBRIDGE_SESSION_TOKEN to OPENAI_CODER_AIGATEWAY_SESSION_TOKEN.
OIAgent filters the subprocess env and strips vars not prefixed with OPENAI_,
so the AI Gateway token was lost when running Codex through Omnigent's native
Codex bridge. Using an OPENAI_ prefix fixes this at the source.

Bump version to 5.2.1.
@matifali matifali merged commit 93875e2 into main Jun 26, 2026
4 checks passed
@matifali matifali deleted the matifali/codex-rename-session-token-env branch June 26, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants