feat(proxy): annotate GET /v1/models behind ?debug #14
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/models-debug"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The plain catalog is ids and nothing else, which is right for a client and
useless when that client is being told its model does not exist. The mapping
exists in the startup log and in slp_upstream_model_info, neither of which is
at hand mid-incident.
?debug answers from the same route table the plain catalog is built from --
no backend is touched -- adding the upstream model name, where that name came
from (discovered / pending / pinned / passthrough), the last probe outcome,
and the route's timeout, retry, and aggregate settings.
The upstream URL is deliberately not among them. /v1/models is
unauthenticated, and naming backend hosts there would undo the reticence
clientErr already keeps on the error path, where a dial failure tells the log
the host, port, and resolved IP and tells the client "upstream request
failed". Probe failures are the same: last_probe says "error", the log says
which address refused.
Plain and debug entries are separate types over one envelope, so the
unparameterized response cannot drift. Route grows a lastProbe written by the
supervisor beside the existing metric; nothing on the request path reads it.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Automated review by pr-reviewer v0.42.1 | Safety Check | Claude Sonnet 5 | tracking id
r-68557b-f31621This is an AI-generated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: LGTM — The PR adds a well-tested, additive debug view to /v1/models that explicitly avoids leaking upstream host/URL info, and nothing in the diff looks alarming.
Reviewed the diff for the ?debug annotation feature on GET /v1/models.
model/debugModeltypes over a genericcatalog[T]envelope), so there's no risk of the unparameterized response drifting.debugRequestedcorrectly treats bare?debug,?debug=1,?debug=yesas true and only explicitfalse/0as false — matches the documented behavior and is tested.TestServeModelsDebugDoesNotLeakUpstreamURLs) verifying no host strings leak into the response. This is the one place I'd worry about a security regression, and it looks handled correctly.recordProbefans out to both the metrics recorder and the newroute.NoteProbe, done atomically viaatomic.Pointer[probeState], avoiding races since the route field is read concurrently by requests.lastProbefield is documented as purely observational (not read on the request path), consistent with the PR's stated design goal, and I don't see any place where it influences routing decisions.last_probe_atfor unprobed routes, and the debug flag parsing — reasonable coverage for the new logic.Nothing here looks like it would cause incorrect behavior or a security issue; the feature does what it claims and takes care not to leak upstream host info through the newly-added unauthenticated debug view.