Repository navigation
fix(ai-gateway): never forward custom LLM upstream errors to users - #7777
Closed
chrarnoldus wants to merge 1 commit into
Closed
chrarnoldus wants to merge 1 commit into
chrarnoldus wants to merge 1 commit into
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummaryReviewed the custom-LLM/stealth stream-error redaction across the AI-gateway helpers and response rewriters; the redaction correctly targets the real HTTP and stream error shapes, no defects found in the changed code. Files Reviewed (6 files)
Detail
Reviewed by deepseek-v4.1-flash · Input: 141.3K · Output: 33.5K · Cached: 2.2M Review guidance: REVIEW.md from base branch |
1 task
Contributor
Author
|
We don't want this. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A custom LLM upstream is private infrastructure. Until now its error bodies reached the user unchanged, which can expose internal URLs, model names, or account details. This PR stops forwarding them:
makeErrorReadablenow answers every non-2xx custom LLM response with the genericupstream_errorused for stealth models. A context overflow is still reported so clients can compact, but with a Kilo-authored message instead of the upstream body.rewriteModelResponsereplaces error details in stream events with the same generic message: chat completionserror, Messageserrorevents, and Responseserror/response.failed. This applies whenevershouldRedactErrorResponseis true, which is now custom LLMs plus stealth models.This is a prep PR for #7291, where custom LLMs can become public.
Verification
Visual Changes
N/A
Reviewer Notes
Stealth models already had HTTP errors redacted. Their stream error events are now redacted too, for consistency.