Baseline for the Kong replacement on api.riotpiao.com. Brings the working tree under version control for the first time: gateway source, the task board that drives the agent runs, test fixtures, and K8s manifests. Anchor the gateway ignore rule to the repo root. Unanchored, "gateway" also matched the cmd/gateway/ source directory, so the program entrypoint was excluded from every commit. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1.8 KiB
1.8 KiB
2.3 — Unknown and missing model errors (RED)
Phase: 2 — LLM surface Stage: RED Depends on: 2.1, 2.2
POST /v1/chat/completionswith amodelthat is not in the configured registry returns a 4xx client error, never 5xx- A request with no
modelfield, a nullmodel, or an empty-stringmodelis the same class of client error - A body that is not valid JSON is also a client error, distinguishable from an unknown model
- The response is RFC 9457 with
Content-Type: application/problem+json - The problem body names the rejected value and enumerates every currently configured model name, derived from the registry rather than written out by hand
- No fallback to a default model happens under any of these conditions, and no upstream is contacted
- The rejection is logged with its reason; the request body is not logged
Write the failing tests first. A silent fallback to a default model is the specific failure mode this task exists to prevent: it turns a client typo into a bill against the wrong GPU and hides the mistake from the caller.
Verify
curl -s -i localhost:8080/v1/chat/completions -H 'content-type: application/json' \
-d '{"model":"gpt-4","messages":[]}'
# expected: 400 (or 404), content-type: application/problem+json, body lists reasoning, ornith:35b, qwen2.5:3b-instruct, and the embedding/rerank models
curl -s -o /dev/null -w '%{http_code}\n' localhost:8080/v1/chat/completions \
-H 'content-type: application/json' -d '{"messages":[]}'
# expected: 4xx, no upstream stub recorded any hit
curl -s -o /dev/null -w '%{http_code}\n' localhost:8080/v1/chat/completions \
-H 'content-type: application/json' -d 'not json'
# expected: 400, problem+json, reason distinct from unknown-model