Commit Graph
4 Commits
Author SHA1 Message Date
Story Crater BotandClaude Opus 5 826a2acda3 fix(api): unbreak >10.6KB LLM requests and actually bind key-auth to the model routes
Two independent bugs, both silent, both found while pointing an agent harness
at api.riotpiao.com.

1. Requests over ~10.6KB failed with HTTP 400
   {"error":{"message":"[] is too short - 'messages'"}}.

   The request-transformer plugin on the llm-chat-* routes rewrites the JSON
   body, which means it reads it via kong.request.get_body(). That returns
   nothing once nginx spills the body past client_body_buffer_size into a temp
   file, so the plugin re-serialized a body with no `messages` and the upstream
   rejected it. Measured on /v1/ornith/chat/completions: 10588 B -> 200,
   11088 B -> 400. Isolated by size-sweeping /v1/embeddings, the one route with
   no request-transformer, which passed an 18057 B body straight through to a
   semantic 413 from TEI.

   Raises the Kong http-block buffer to 16m. Any agent request carrying tool
   schemas clears the old ceiling in a single turn.

2. key-auth was never applied to any model route.

   The model-key-auth KongPlugin sat in namespace `api` while all five routes
   that annotate it live in `llm-serving`. The ingress controller resolves
   konghq.com/plugins against the annotated object's own namespace, so the
   reference dangled and the plugin never bound. Verified before the fix:
   unauthenticated GET /v1/models and POST /v1/ornith/chat/completions both
   returned 200. A dangling plugin reference fails open and logs nothing.

   Re-test both without a key after this syncs; expect 401.

Note for follow-up: llm-embeddings and llm-score carry no plugins annotation at
all, so they stay unauthenticated even after this change.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-08-13 21:34:50 -07:00
Story Crater Bot b695cee987 fix(api): label Kong pods llm-client=true so llm-serving NetworkPolicy admits them — chat/embeddings/rerank/score routes silently hung until the client timeout because Cilium dropped Kong's packets
llm-serving-default-deny admits port 8080 only from pods carrying
llm-client=true. Kong lacked it, so every route that actually contacts an
upstream timed out. /v1/models masked the problem: request-termination answers
inside Kong and never touches an upstream, so it returned 200 throughout.

Opting in via podLabels rather than relaxing the policy — it is a compensating
control, not hygiene, since vLLM v0.11.0 is frozen on Volta and will not receive
patches for several remote/unauthenticated advisories.

podLabels land only in the pod template, not spec.selector.matchLabels, so this
is not an immutable-field change.
2026-08-13 07:55:21 -07:00
Story Crater Bot 245a03e951 feat(api): add DeepSeek-shaped LLM API on Kong — /v1/models, per-model chat completions, embeddings, rerank, score; disable Kong response buffering so stream:true actually streams
Kong matches routes on host/path/method/header, never on the request body, so a
single /v1/chat/completions dispatching on body.model is not expressible in Kong
OSS (ai-proxy-advanced, which does multi-target model routing, is Enterprise).
Model therefore goes in the path:

  GET  /v1/models                        static list (request-termination)
  POST /v1/reasoning/chat/completions     reasoning-predictor  (vLLM)
  POST /v1/ornith/chat/completions        ornith-predictor     (Ollama)
  POST /v1/qwen/chat/completions          ornith-predictor     (Ollama, same pod)
  POST /v1/embeddings                     embeddings-predictor (TEI)
  POST /v1/rerank                         reranker-predictor   (TEI)
  POST /v1/score                          verifier-predictor   (vLLM pooling)

- each chat route force-overwrites body.model via request-transformer add+replace:
  ornith:35b and qwen2.5:3b-instruct share one Ollama pod, so without this a
  client hitting /v1/qwen with "model":"ornith:35b" would silently get the 35B
- routes live in ns llm-serving, not api: an Ingress can only reference a Service
  in its own namespace, and KIC watches all namespaces
- embeddings and score need no rewrite (TEI/vLLM already serve the canonical
  paths); rerank does, since /v1/rerank 404s and only /rerank exists
- read/write timeouts 1h: Kong defaults to 60s, which a 32B model on Volta
  exceeds mid-generation and returns 504
- nginx_proxy_proxy_buffering=off: buffered responses lump or stall SSE, and both
  hops (nginx Ingress and Kong) must be unbuffered or the buffered one wins
- no auth for now, per decision; api.riotpiao.com is reachable through nginx, so
  GPU time is currently unauthenticated
2026-08-13 07:47:45 -07:00
Story Crater Bot 063f9bcd23 fix(homarr): add AUTH_OIDC_URI + email account linking — homarr hides the Authentik sign-in button unless AUTH_OIDC_URI (authorize endpoint) is set alongside AUTH_OIDC_ISSUER (per authentik/homarr SSO docs); was the missing var 2026-08-13 07:26:59 -07:00