Skip to content

Commit c12e854

Browse files
committed
fix(agent): normalize BUX_CP_CODEX_URL scheme before building base_url (Cubic, ENG-4785)
Coerce the value to an absolute https:// base_url: tolerate a bare host or a stray ws/wss value rather than emitting a scheme-less base_url that silently breaks Codex routing.
1 parent dc24ec1 commit c12e854

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

agent/bootstrap.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,17 @@ fi
133133
if [ -z "$BUX_CP_CODEX_URL" ]; then
134134
echo "bootstrap: BUX_CP_CODEX_URL not set; skipping free-tier Codex provider" >&2
135135
else
136+
# Normalize the scheme: Codex needs an absolute https:// base_url. The value is
137+
# meant to be a full URL, but tolerate a bare host (or ws/wss left over from a
138+
# misconfigured SSM value) by coercing to https:// rather than emitting an
139+
# invalid scheme-less base_url that silently breaks routing.
140+
case "$BUX_CP_CODEX_URL" in
141+
https://*) ;;
142+
http://*) ;;
143+
wss://*) BUX_CP_CODEX_URL="https://${BUX_CP_CODEX_URL#wss://}" ;;
144+
ws://*) BUX_CP_CODEX_URL="http://${BUX_CP_CODEX_URL#ws://}" ;;
145+
*) BUX_CP_CODEX_URL="https://${BUX_CP_CODEX_URL}" ;;
146+
esac
136147
CP_BASE="${BUX_CP_CODEX_URL%/}/api/codex/v1"
137148
sudo -u bux -H CP_BASE="$CP_BASE" bash -c '
138149
CODEX_CONFIG="$HOME/.codex/config.toml"

0 commit comments

Comments
 (0)