Skip to content

Commit e3abbb9

Browse files
authored
maintenance(coder-labs/modules/codex): skip migration notice and add agentapi type flag (#781)
This PR introduces: 1. Adding --type flag to agentapi command 2. Introduce `[notice.model_migrations]` to skip migration notice, improves tasks UX 3. Set profile = "aibridge" rather than passing it using --profile flag ## Description <!-- Briefly describe what this PR does and why --> ## Type of Change - [ ] New module - [ ] New template - [x] Bug fix - [x] Feature/enhancement - [ ] Documentation - [ ] Other ## Module Information **Path:** `registry/coder-labs/modules/codex` **New version:** `v4.1.2` **Breaking change:** [ ] Yes [x] No ## Testing & Validation - [x] Tests pass (`bun test`) - [x] Code formatted (`bun fmt`) - [x] Changes tested locally ## Related Issues Closes: #740
1 parent 71a4cf2 commit e3abbb9

5 files changed

Lines changed: 32 additions & 29 deletions

File tree

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

Lines changed: 5 additions & 5 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.1.1"
16+
version = "4.1.2"
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.1.1"
35+
version = "4.1.2"
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.1.1"
54+
version = "4.1.2"
5555
agent_id = coder_agent.example.id
5656
workdir = "/home/coder/project"
5757
enable_aibridge = true
@@ -94,7 +94,7 @@ data "coder_task" "me" {}
9494
9595
module "codex" {
9696
source = "registry.coder.com/coder-labs/codex/coder"
97-
version = "4.1.1"
97+
version = "4.1.2"
9898
agent_id = coder_agent.example.id
9999
openai_api_key = "..."
100100
ai_prompt = data.coder_task.me.prompt
@@ -112,7 +112,7 @@ This example shows additional configuration options for custom models, MCP serve
112112
```tf
113113
module "codex" {
114114
source = "registry.coder.com/coder-labs/codex/coder"
115-
version = "4.1.1"
115+
version = "4.1.2"
116116
agent_id = coder_agent.example.id
117117
openai_api_key = "..."
118118
workdir = "/home/coder/project"

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

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -464,22 +464,13 @@ describe("codex", async () => {
464464
});
465465

466466
await execModuleScript(id);
467-
468-
const startLog = await readFileContainer(
469-
id,
470-
"/home/coder/.codex-module/agentapi-start.log",
471-
);
472-
473467
const configToml = await readFileContainer(
474468
id,
475469
"/home/coder/.codex/config.toml",
476470
);
477-
expect(startLog).toContain("AI Bridge is enabled, using profile aibridge");
478-
expect(startLog).toContain(
479-
"Starting Codex with arguments: --profile aibridge",
480-
);
481471
expect(configToml).toContain(
482472
"[profiles.aibridge]\n" + 'model_provider = "aibridge"',
483473
);
474+
expect(configToml).toContain('profile = "aibridge"');
484475
});
485476
});

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

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ variable "agentapi_version" {
136136

137137
variable "codex_model" {
138138
type = string
139-
description = "The model for Codex to use. Defaults to gpt-5.2-codex."
140-
default = "gpt-5.2-codex"
139+
description = "The model for Codex to use. Defaults to gpt-5.3-codex."
140+
default = "gpt-5.3-codex"
141141
}
142142

143143
variable "pre_install_script" {
@@ -184,12 +184,13 @@ resource "coder_env" "coder_aibridge_session_token" {
184184
}
185185

186186
locals {
187-
workdir = trimsuffix(var.workdir, "/")
188-
app_slug = "codex"
189-
install_script = file("${path.module}/scripts/install.sh")
190-
start_script = file("${path.module}/scripts/start.sh")
191-
module_dir_name = ".codex-module"
192-
aibridge_config = <<-EOF
187+
workdir = trimsuffix(var.workdir, "/")
188+
app_slug = "codex"
189+
install_script = file("${path.module}/scripts/install.sh")
190+
start_script = file("${path.module}/scripts/start.sh")
191+
module_dir_name = ".codex-module"
192+
latest_codex_model = "gpt-5.3-codex"
193+
aibridge_config = <<-EOF
193194
[model_providers.aibridge]
194195
name = "AI Bridge"
195196
base_url = "${data.coder_workspace.me.access_url}/api/v2/aibridge/openai/v1"
@@ -249,6 +250,8 @@ module "agentapi" {
249250
chmod +x /tmp/install.sh
250251
ARG_OPENAI_API_KEY='${var.openai_api_key}' \
251252
ARG_REPORT_TASKS='${var.report_tasks}' \
253+
ARG_CODEX_MODEL='${var.codex_model}' \
254+
ARG_LATEST_CODEX_MODEL='${local.latest_codex_model}' \
252255
ARG_INSTALL='${var.install_codex}' \
253256
ARG_CODEX_VERSION='${var.codex_version}' \
254257
ARG_BASE_CONFIG_TOML='${base64encode(var.base_config_toml)}' \

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ echo "=== Codex Module Configuration ==="
2020
printf "Install Codex: %s\n" "$ARG_INSTALL"
2121
printf "Codex Version: %s\n" "$ARG_CODEX_VERSION"
2222
printf "App Slug: %s\n" "$ARG_CODER_MCP_APP_STATUS_SLUG"
23+
printf "Codex Model: %s\n" "${ARG_CODEX_MODEL:-"Default"}"
24+
printf "Latest Codex Model: %s\n" "${ARG_LATEST_CODEX_MODEL}"
2325
printf "Start Directory: %s\n" "$ARG_CODEX_START_DIRECTORY"
2426
printf "Has Base Config: %s\n" "$([ -n "$ARG_BASE_CONFIG_TOML" ] && echo "Yes" || echo "No")"
2527
printf "Has Additional MCP: %s\n" "$([ -n "$ARG_ADDITIONAL_MCP_SERVERS" ] && echo "Yes" || echo "No")"
@@ -90,15 +92,25 @@ function install_codex() {
9092

9193
write_minimal_default_config() {
9294
local config_path="$1"
95+
96+
ARG_DEFAULT_PROFILE=""
97+
98+
if [[ "${ARG_ENABLE_AIBRIDGE}" = "true" ]]; then
99+
ARG_DEFAULT_PROFILE='profile = "aibridge"'
100+
fi
101+
93102
cat << EOF > "$config_path"
94103
# Minimal Default Codex Configuration
95104
sandbox_mode = "workspace-write"
96105
approval_policy = "never"
97106
preferred_auth_method = "apikey"
107+
${ARG_DEFAULT_PROFILE}
98108
99109
[sandbox_workspace_write]
100110
network_access = true
101111
112+
[notice.model_migrations]
113+
"${ARG_CODEX_MODEL}" = "${ARG_LATEST_CODEX_MODEL}"
102114
EOF
103115
}
104116

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,8 @@ setup_workdir() {
155155
build_codex_args() {
156156
CODEX_ARGS=()
157157

158-
if [ "$ARG_ENABLE_AIBRIDGE" = "true" ]; then
159-
printf "AI Bridge is enabled, using profile aibridge\n"
160-
CODEX_ARGS+=("--profile" "aibridge")
161-
elif [ -n "$ARG_CODEX_MODEL" ]; then
162-
CODEX_ARGS+=("--model" "$ARG_CODEX_MODEL")
158+
if [[ -n "${ARG_CODEX_MODEL}" ]] && [[ "${ARG_ENABLE_AIBRIDGE}" != "true" ]]; then
159+
CODEX_ARGS+=("--model" "${ARG_CODEX_MODEL}")
163160
fi
164161

165162
if [ "$ARG_CONTINUE" = "true" ]; then
@@ -213,7 +210,7 @@ capture_session_id() {
213210

214211
start_codex() {
215212
printf "Starting Codex with arguments: %s\n" "${CODEX_ARGS[*]}"
216-
agentapi server --term-width 67 --term-height 1190 -- codex "${CODEX_ARGS[@]}" &
213+
agentapi server --type codex --term-width 67 --term-height 1190 -- codex "${CODEX_ARGS[@]}" &
217214
capture_session_id
218215
}
219216

0 commit comments

Comments
 (0)