From 9af62366b7e28f1462a402087cf8092924a5afe1 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Wed, 4 Feb 2026 10:29:54 +0000 Subject: [PATCH] fix(codex): P2 - override profile when enable_aibridge=true The previous fix would skip setting profile when one already existed, breaking enable_aibridge=true with custom base configs. Now when enable_aibridge=true, we explicitly remove any existing profile line and set profile="aibridge" (since enable_aibridge=true is an explicit user intention to use AI Bridge). --- .../coder-labs/modules/codex/scripts/install.sh | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/registry/coder-labs/modules/codex/scripts/install.sh b/registry/coder-labs/modules/codex/scripts/install.sh index 61985dda..d1fdd505 100644 --- a/registry/coder-labs/modules/codex/scripts/install.sh +++ b/registry/coder-labs/modules/codex/scripts/install.sh @@ -154,15 +154,13 @@ function populate_config_toml() { # Set aibridge as default profile when AI Bridge is enabled # This allows users to run `codex` without --profile flag if [ "$ARG_ENABLE_AIBRIDGE" = "true" ]; then - # Only prepend if profile key doesn't already exist - if ! grep -q "^profile\s*=" "$CONFIG_PATH"; then - printf "Setting aibridge as default profile\n" - local temp_config - temp_config=$(cat "$CONFIG_PATH") - echo -e "profile = \"aibridge\"\n\n$temp_config" > "$CONFIG_PATH" - else - printf "Profile already defined in base config, skipping default profile setup\n" - fi + printf "Setting aibridge as default profile\n" + # Remove any existing profile line from base config (since enable_aibridge=true is explicit) + sed -i '/^profile\s*=/d' "$CONFIG_PATH" + # Prepend profile = "aibridge" to the config + local temp_config + temp_config=$(cat "$CONFIG_PATH") + echo -e "profile = \"aibridge\"\n\n$temp_config" > "$CONFIG_PATH" fi append_mcp_servers_section "$CONFIG_PATH"