Preserve filter HTTPException and return 429 in the rate limit example#597
Open
sebnowak wants to merge 1 commit into
Open
Preserve filter HTTPException and return 429 in the rate limit example#597sebnowak wants to merge 1 commit into
sebnowak wants to merge 1 commit into
Conversation
This was referenced Mar 16, 2026
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.
I ran into this while testing the rate-limit filter pipeline through Open WebUI.
Currently, the filter endpoints in
main.pywrap any exception as500. That means a filter cannot intentionally return something like429and expect the caller to receive that status.The rate-limit example also raises a plain
Exception, so even when it is enforcing the limit, the response looks like an internal error instead of a real rate-limit response.This patch keeps
HTTPExceptionintact in the filter endpoints and updates the rate-limit example to raiseHTTPException(status_code=429, ...).Scope of this PR:
500behavior for unexpected exceptions429instead of a generic errorI have a matching Open WebUI PR (open-webui/open-webui#22726).
I have personally tested the changes. How I tested:
python3 test_pipelines_http_errors.py(test creation was supported by Codex)filter_inletpreserves a raisedHTTPException(429, ...)filter_outletpreserves a raisedHTTPException(429, ...)429on the blocked request instead of a generic exceptionCLI otuput:
TEST
test_pipelines_http_errors.py