Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions .github/scripts/check-proxy-port-fallbacks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# variables:
#
# - bin/<name>-proxy.mjs: parseProxyPort('<VAR>', <port>) (or the older
# process.env.<VAR> || '<port>' form)
# process.env.<VAR> || '<port>' form, or antigravity-direct's
# Number(process.env.<VAR> || <port>) form)
# - .opencode/opencode.jsonc: {env:<VAR>:-<port>} in the provider
# baseURL (opencode's {env:VAR} substitution has no fallback of its
# own; the :- form is what keeps a non-shell launch — systemd
Expand All @@ -18,7 +19,17 @@
# the let-block definition, when a baseURL loses its :- fallback, or
# when a bare {env:<VAR>} or a literal proxy port reappears in
# opencode.jsonc. Clef has no opencode.jsonc consumer (its models ride
# the Cloudflare gateway), so only its script fallback is checked.
# the Cloudflare gateway), so only its script fallback is checked; the
# route proxy likewise has no baseURL in this repo.
#
# Retired 2026-10-30 (bce524fc): agy-proxy (:18743) and
# antigravity-ls-proxy (:18745) — their lets and units were removed and
# antigravity-direct (:18751, below) is the single Antigravity door.
# Their bin/ scripts remain in the repo as history, uninvoked, and
# their disabled opencode.jsonc providers keep the old fallbacks; see
# the retirement note in home/common/default.nix. They are deliberately
# NOT rows here — restoring one means restoring its let from git
# history and re-adding its row in the same change (#2961).
set -euo pipefail

repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
Expand All @@ -28,12 +39,13 @@ config_file="$repo_root/.opencode/opencode.jsonc"
# var | let binding | proxy script | has an opencode.jsonc baseURL
proxies=(
"CLEF_PROXY_PORT|clefProxyPort|bin/clef-proxy.mjs|no"
"AGY_PROXY_PORT|agyProxyPort|bin/agy-proxy.mjs|yes"
"CODEX_PROXY_PORT|codexProxyPort|bin/codex-proxy.mjs|yes"
"ANTIGRAVITY_LS_PROXY_PORT|antigravityLsProxyPort|bin/antigravity-ls-proxy.mjs|yes"
"DESIGN_CODE_PROXY_PORT|designCodeProxyPort|bin/design-code-proxy.mjs|yes"
"MUSE_PROXY_PORT|museProxyPort|bin/muse-proxy.mjs|yes"
"COMMANDCODE_PROXY_PORT|commandcodeProxyPort|bin/commandcode-proxy.mjs|yes"
"CLAUDE_CODE_PROXY_PORT|claudeCodeProxyPort|bin/claude-code-proxy.mjs|yes"
"OPENCODE_ROUTE_PROXY_PORT|opencodeRouteProxyPort|bin/opencode-route-proxy.mjs|no"
"ANTIGRAVITY_DIRECT_PORT|antigravityDirectProxyPort|bin/antigravity-direct.mjs|yes"
)

failed=0
Expand All @@ -48,7 +60,9 @@ for entry in "${proxies[@]}"; do
fi

if ! grep -qF "parseProxyPort('${var}', ${let_port})" "$repo_root/$script" &&
! grep -qF "process.env.${var} || '${let_port}'" "$repo_root/$script"; then
! grep -qF "parseProxyPort(\"${var}\", ${let_port})" "$repo_root/$script" &&
! grep -qF "process.env.${var} || '${let_port}'" "$repo_root/$script" &&
! grep -qF "process.env.${var} || ${let_port}" "$repo_root/$script"; then
echo "::error::$script fallback for ${var} does not match the ${let_name} definition (${let_port}) in home/common/default.nix."
failed=1
fi
Expand All @@ -63,7 +77,7 @@ for entry in "${proxies[@]}"; do
fi
done

if grep -qE '127\.0\.0\.1:1874[0-9]' "$config_file"; then
if grep -qE '127\.0\.0\.1:187(4[0-9]|5[01])' "$config_file"; then
echo "::error::.opencode/opencode.jsonc hardcodes a literal proxy port — use {env:<VAR>:-<port>} so the copies cannot drift (#435)."
failed=1
fi
Expand Down