Problem
get_gateway_host() auto-constructs an AI Gateway URL from DATABRICKS_WORKSPACE_ID (always set on Databricks Apps) without checking if the gateway actually exists. Workspaces without AI Gateway enabled get a FailedToOpenSocket error from Claude Code (Bun runtime) when it tries to connect to the non-existent host.
The fallback to {DATABRICKS_HOST}/serving-endpoints/anthropic never triggers because the gateway URL is returned unconditionally.
Affected code
utils.py:get_gateway_host() — returns unreachable URL without probing
- All setup scripts (
setup_claude.py, setup_codex.py, setup_gemini.py, setup_opencode.py, setup_proxy.py) — inherit the bad URL
Fix
- Probe auto-discovered gateway URLs with a 2s timeout GET before using them
- Cache the result in
_GATEWAY_RESOLVED env var so subprocesses skip re-probing
- Add
resolve_and_cache_gateway() helper called once at boot
PR: #114
Problem
get_gateway_host()auto-constructs an AI Gateway URL fromDATABRICKS_WORKSPACE_ID(always set on Databricks Apps) without checking if the gateway actually exists. Workspaces without AI Gateway enabled get aFailedToOpenSocketerror from Claude Code (Bun runtime) when it tries to connect to the non-existent host.The fallback to
{DATABRICKS_HOST}/serving-endpoints/anthropicnever triggers because the gateway URL is returned unconditionally.Affected code
utils.py:get_gateway_host()— returns unreachable URL without probingsetup_claude.py,setup_codex.py,setup_gemini.py,setup_opencode.py,setup_proxy.py) — inherit the bad URLFix
_GATEWAY_RESOLVEDenv var so subprocesses skip re-probingresolve_and_cache_gateway()helper called once at bootPR: #114