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).
This commit is contained in:
Atif Ali 2026-02-04 10:29:54 +00:00
parent 46726a903d
commit 9af62366b7

View File

@ -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"