Skip to content

Commit ce50e52

Browse files
authored
feat(coder-labs/modules/codex): update default configuration to use model providers instead of profiles (#806)
## Description - update default configuration to use model providers instead of profiles ## Type of Change - [ ] New module - [ ] New template - [ ] Bug fix - [x] Feature/enhancement - [ ] Documentation - [ ] Other ## Module Information <!-- Delete this section if not applicable --> **Path:** `registry/coder-labs/modules/codex` **New version:** `v4.3.1` **Breaking change:** [ ] Yes [x] No ## Testing & Validation - [x] Tests pass (`bun test`) - [x] Code formatted (`bun fmt`) - [x] Changes tested locally ## Related Issues <!-- Link related issues or write "None" if not applicable -->
1 parent 6940774 commit ce50e52

5 files changed

Lines changed: 27 additions & 30 deletions

File tree

registry/coder-labs/modules/codex/README.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Run Codex CLI in your workspace to access OpenAI's models through the Codex inte
1313
```tf
1414
module "codex" {
1515
source = "registry.coder.com/coder-labs/codex/coder"
16-
version = "4.3.0"
16+
version = "4.3.1"
1717
agent_id = coder_agent.example.id
1818
openai_api_key = var.openai_api_key
1919
workdir = "/home/coder/project"
@@ -32,7 +32,7 @@ module "codex" {
3232
module "codex" {
3333
count = data.coder_workspace.me.start_count
3434
source = "registry.coder.com/coder-labs/codex/coder"
35-
version = "4.3.0"
35+
version = "4.3.1"
3636
agent_id = coder_agent.example.id
3737
openai_api_key = "..."
3838
workdir = "/home/coder/project"
@@ -51,7 +51,7 @@ For tasks integration with AI Bridge, add `enable_aibridge = true` to the [Usage
5151
```tf
5252
module "codex" {
5353
source = "registry.coder.com/coder-labs/codex/coder"
54-
version = "4.3.0"
54+
version = "4.3.1"
5555
agent_id = coder_agent.example.id
5656
workdir = "/home/coder/project"
5757
enable_aibridge = true
@@ -60,21 +60,16 @@ module "codex" {
6060

6161
When `enable_aibridge = true`, the module:
6262

63-
- Configures Codex to use the AI Bridge profile with `base_url` pointing to `${data.coder_workspace.me.access_url}/api/v2/aibridge/openai/v1` and `env_key` pointing to the workspace owner's session token
63+
- Configures Codex to use the aibridge model_provider with `base_url` pointing to `${data.coder_workspace.me.access_url}/api/v2/aibridge/openai/v1` and `env_key` pointing to the workspace owner's session token
6464

6565
```toml
66-
profile = "aibridge" # sets the default profile to aibridge
66+
model_provider = "aibridge"
6767

6868
[model_providers.aibridge]
6969
name = "AI Bridge"
7070
base_url = "https://example.coder.com/api/v2/aibridge/openai/v1"
7171
env_key = "CODER_AIBRIDGE_SESSION_TOKEN"
7272
wire_api = "responses"
73-
74-
[profiles.aibridge]
75-
model_provider = "aibridge"
76-
model = "<model>" # as configured in the module input
77-
model_reasoning_effort = "<model_reasoning_effort>" # as configured in the module input
7873
```
7974

8075
This allows Codex to route API requests through Coder's AI Bridge instead of directly to OpenAI's API.
@@ -94,7 +89,7 @@ data "coder_task" "me" {}
9489
9590
module "codex" {
9691
source = "registry.coder.com/coder-labs/codex/coder"
97-
version = "4.3.0"
92+
version = "4.3.1"
9893
agent_id = coder_agent.example.id
9994
openai_api_key = "..."
10095
ai_prompt = data.coder_task.me.prompt
@@ -114,7 +109,7 @@ By default, when `enable_boundary = true`, the module uses `coder boundary` subc
114109
```tf
115110
module "codex" {
116111
source = "registry.coder.com/coder-labs/codex/coder"
117-
version = "4.3.0"
112+
version = "4.3.1"
118113
agent_id = coder_agent.main.id
119114
openai_api_key = var.openai_api_key
120115
workdir = "/home/coder/project"
@@ -132,7 +127,7 @@ This example shows additional configuration options for custom models, MCP serve
132127
```tf
133128
module "codex" {
134129
source = "registry.coder.com/coder-labs/codex/coder"
135-
version = "4.3.0"
130+
version = "4.3.1"
136131
agent_id = coder_agent.example.id
137132
openai_api_key = "..."
138133
workdir = "/home/coder/project"

registry/coder-labs/modules/codex/main.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,10 +468,7 @@ describe("codex", async () => {
468468
id,
469469
"/home/coder/.codex/config.toml",
470470
);
471-
expect(configToml).toContain(
472-
"[profiles.aibridge]\n" + 'model_provider = "aibridge"',
473-
);
474-
expect(configToml).toContain('profile = "aibridge"');
471+
expect(configToml).toContain('model_provider = "aibridge"');
475472
});
476473

477474
test("boundary-enabled", async () => {

registry/coder-labs/modules/codex/main.tf

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ variable "enable_aibridge" {
8484

8585
variable "model_reasoning_effort" {
8686
type = string
87-
description = "The reasoning effort for the AI Bridge model. One of: none, low, medium, high. https://platform.openai.com/docs/guides/latest-model#lower-reasoning-effort"
88-
default = "medium"
87+
description = "The reasoning effort for the model. One of: none, low, medium, high. https://platform.openai.com/docs/guides/latest-model#lower-reasoning-effort"
88+
default = ""
8989
validation {
90-
condition = contains(["none", "low", "medium", "high"], var.model_reasoning_effort)
90+
condition = contains(["", "none", "minimal", "low", "medium", "high", "xhigh"], var.model_reasoning_effort)
9191
error_message = "model_reasoning_effort must be one of: none, low, medium, high."
9292
}
9393
}
@@ -137,7 +137,7 @@ variable "agentapi_version" {
137137
variable "codex_model" {
138138
type = string
139139
description = "The model for Codex to use. Defaults to gpt-5.3-codex."
140-
default = "gpt-5.3-codex"
140+
default = "gpt-5.4"
141141
}
142142

143143
variable "pre_install_script" {
@@ -225,18 +225,14 @@ locals {
225225
install_script = file("${path.module}/scripts/install.sh")
226226
start_script = file("${path.module}/scripts/start.sh")
227227
module_dir_name = ".codex-module"
228-
latest_codex_model = "gpt-5.3-codex"
228+
latest_codex_model = "gpt-5.4"
229229
aibridge_config = <<-EOF
230230
[model_providers.aibridge]
231231
name = "AI Bridge"
232232
base_url = "${data.coder_workspace.me.access_url}/api/v2/aibridge/openai/v1"
233233
env_key = "CODER_AIBRIDGE_SESSION_TOKEN"
234234
wire_api = "responses"
235235
236-
[profiles.aibridge]
237-
model_provider = "aibridge"
238-
model = "${var.codex_model}"
239-
model_reasoning_effort = "${var.model_reasoning_effort}"
240236
EOF
241237
}
242238

@@ -302,6 +298,7 @@ module "agentapi" {
302298
ARG_ADDITIONAL_MCP_SERVERS='${base64encode(var.additional_mcp_servers)}' \
303299
ARG_CODER_MCP_APP_STATUS_SLUG='${local.app_slug}' \
304300
ARG_CODEX_START_DIRECTORY='${local.workdir}' \
301+
ARG_MODEL_REASONING_EFFORT='${var.model_reasoning_effort}' \
305302
ARG_CODEX_INSTRUCTION_PROMPT='${base64encode(var.codex_system_prompt)}' \
306303
/tmp/install.sh
307304
EOT

registry/coder-labs/modules/codex/scripts/install.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,24 +93,32 @@ function install_codex() {
9393
write_minimal_default_config() {
9494
local config_path="$1"
9595

96-
ARG_DEFAULT_PROFILE=""
96+
ARG_OPTIONAL_TOP_LEVEL_CONFIG=""
9797

9898
if [[ "${ARG_ENABLE_AIBRIDGE}" = "true" ]]; then
99-
ARG_DEFAULT_PROFILE='profile = "aibridge"'
99+
ARG_OPTIONAL_TOP_LEVEL_CONFIG='model_provider = "aibridge"'
100+
fi
101+
102+
if [[ "${ARG_MODEL_REASONING_EFFORT}" != "" ]]; then
103+
ARG_OPTIONAL_TOP_LEVEL_CONFIG+=$'\n'"model_reasoning_effort = \"${ARG_MODEL_REASONING_EFFORT}\""
100104
fi
101105

102106
cat << EOF > "$config_path"
103107
# Minimal Default Codex Configuration
104108
sandbox_mode = "workspace-write"
105109
approval_policy = "never"
106110
preferred_auth_method = "apikey"
107-
${ARG_DEFAULT_PROFILE}
111+
${ARG_OPTIONAL_TOP_LEVEL_CONFIG}
108112
109113
[sandbox_workspace_write]
110114
network_access = true
111115
112116
[notice.model_migrations]
113117
"${ARG_CODEX_MODEL}" = "${ARG_LATEST_CODEX_MODEL}"
118+
119+
[projects."${ARG_CODEX_START_DIRECTORY}"]
120+
trust_level = "trusted"
121+
114122
EOF
115123
}
116124

registry/coder-labs/modules/codex/scripts/start.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ setup_workdir() {
155155
build_codex_args() {
156156
CODEX_ARGS=()
157157

158-
if [[ -n "${ARG_CODEX_MODEL}" ]] && [[ "${ARG_ENABLE_AIBRIDGE}" != "true" ]]; then
158+
if [[ -n "${ARG_CODEX_MODEL}" ]]; then
159159
CODEX_ARGS+=("--model" "${ARG_CODEX_MODEL}")
160160
fi
161161

0 commit comments

Comments
 (0)