fix: remove FilteredStream stdout/stderr wrapper#5326
Merged
Conversation
Wrapping sys.stdout and sys.stderr at import time with a threading.Lock is not fork-safe and adds overhead to every print call. litellm.suppress_debug_info already silences the noisy output this was designed to filter.
iris-clawd
reviewed
Apr 7, 2026
iris-clawd
left a comment
Contributor
There was a problem hiding this comment.
Review: Remove FilteredStream
Excellent cleanup. This is the kind of change that silently fixes a whole class of bugs.
✅ Strong approve
- The
FilteredStreamwas wrappingsys.stdout/sys.stderrat import time — everyprint()in the entire process went through athreading.Lock+str.lower()+ substring match. That's measurable overhead on hot paths. - Not fork-safe: Celery prefork workers would inherit the locked stream, risking deadlocks if a fork happened while the lock was held.
__getattr__delegation on IO streams is a footgun — libraries like Rich, logging handlers, and anything checkingstream.bufferorstream.encodingcan behave unpredictably with proxied streams.litellm.suppress_debug_info = True(already set at line 98) is the correct upstream solution.
No concerns. Ship it. 💬 175
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
FilteredStreamclass that wrappedsys.stdoutandsys.stderrat import time to suppress LiteLLM noiselitellm.suppress_debug_info = Truealready handles thisthreading.Lock+ string comparison to everyprint()call in the process and was not fork-safe for Celery prefork workersTest plan
Note
Low Risk
Low risk: removes an import-time
sys.stdout/sys.stderrwrapper, mainly affecting console/log output; primary potential regression is LiteLLM banner noise reappearing in some environments.Overview
Removes the
FilteredStreamproxy and the import-time wrapping ofsys.stdout/sys.stderrthat previously filtered LiteLLM-related banner output.Cleans up related imports, relying solely on
litellm.suppress_debug_info = Truefor noise suppression instead of intercepting all process output.Reviewed by Cursor Bugbot for commit e68975e. Bugbot is set up for automated code reviews on this repo. Configure here.