fix(backend): wire THUNDERBOLT_INFERENCE_URL through the inference proxy - #1203
fix(backend): wire THUNDERBOLT_INFERENCE_URL through the inference proxy#1203njbrake wants to merge 2 commits into
Conversation
|
Preview environment deployed 🚀
Stack: Auto-destroys on PR close/merge. Login via the bundled Keycloak realm — |
_Note: this PR description was drafted by Claude via back-and-forth with @njbrake. The reasoning and decisions are his; the prose is Claude's._ Makes `THUNDERBOLT_INFERENCE_URL` work. It is documented in `docs/self-hosting/configuration.md` as the way to point a self-hosted backend at an OpenAI-compatible gateway, but nothing read it: the variable was absent from `settings.ts` and from the inference client, so setting it had no effect. Adds the setting, a `thunderbolt-inference` provider in the inference client, and routing in `inference/routes.ts` for model ids the built-in table does not cover. Models are **discovered** from the endpoint's `GET /models` rather than listed by hand, so a gateway that gains a model needs no redeploy. Discovery is cached for five minutes and refreshed when the app fetches `/config`. If the endpoint is unreachable its models are omitted and the built-ins keep working, so a gateway outage cannot break boot. `THUNDERBOLT_INFERENCE_MODELS` stays optional and now does two things when set: restricts which discovered models are exposed, and supplies display names. Requests are proxied through the backend, so the gateway key stays server side and the gateway needs no CORS configuration. Capabilities are advertised conservatively because the endpoint cannot be introspected. Verified against a live gateway: 16 discovered models, and server logs confirming `provider="thunderbolt-inference"` with a 200 on a real completion. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
875e4d7 to
2903ff4
Compare
ital0
left a comment
There was a problem hiding this comment.
Thanks for restoring THUNDERBOLT_INFERENCE_URL. The backend discovery and proxy path make sense, but I do not think the PR works end to end yet.
The main issue is that discovered models are published through reconciled defaults. The current frontend drops unknown model IDs without bundled profiles, so these models never reach the database or picker. The fixed version also means later catalog changes are ignored, while an empty or failed discovery can leave the frontend and backend with different model lists.
I also found inconsistencies around keyless gateways, allowlist parsing, model ID collisions, discovery timeouts, concurrent cache refreshes, and the deployment plumbing for THUNDERBOLT_INFERENCE_MODELS.
Because these issues affect the self-hosting flow described by the PR, my review is request changes.
Deliver gateway-discovered models via a separate non-version-gated /config field (defaults.gatewayModels) reconciled directly with a synthesized profile per row, so they actually reach the picker; add discovery timeout, in-flight dedup, serve-stale-on-failure, allowlist fail-closed, built-in slug-collision drop, keyless-gateway support, and thread THUNDERBOLT_INFERENCE_MODELS through the k8s/Pulumi/workflow deploy paths. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Note: this PR description was drafted by Claude via back-and-forth with @njbrake. The reasoning and decisions are his; the prose is Claude's.
Makes
THUNDERBOLT_INFERENCE_URLwork. It is documented indocs/self-hosting/configuration.mdas the way to point a self-hosted backend at an OpenAI-compatible gateway, but nothing read it: the variable was absent fromsettings.tsand from the inference client, so setting it had no effect.Adds the setting, a
thunderbolt-inferenceprovider in the inference client, and routing ininference/routes.tsfor model ids the built-in table does not cover.Models are discovered from the endpoint's
GET /modelsrather than listed by hand, so a gateway that gains a model needs no redeploy. Discovery is cached for five minutes and refreshed when the app fetches/config. If the endpoint is unreachable its models are omitted and the built-ins keep working, so a gateway outage cannot break boot.THUNDERBOLT_INFERENCE_MODELSstays optional and now does two things when set: restricts which discovered models are exposed, and supplies display names.Requests are proxied through the backend, so the gateway key stays server side and the gateway needs no CORS configuration. Capabilities are advertised conservatively because the endpoint cannot be introspected.
Verified against a live gateway: 16 discovered models, and server logs confirming
provider="thunderbolt-inference"with a 200 on a real completion.