Review view: litellm terminal noise (shipped in v0.2.13) - #458
Open
rejojer wants to merge 10 commits into
Open
Conversation
litellm's OpenRouter adapter probes supports_reasoning() with the provider-stripped model name on every completion, so any model missing from its static map (e.g. openrouter/z-ai/glm-5.3-flash) makes get_llm_provider print a red "Provider List:" banner straight into stdout — interleaved with the streamed answer, once per agent turn. suppress_debug_info is litellm's own embedder switch (its Router sets it too) and gates only this banner and the "Give Feedback / Get Help" one; errors still raise with their full text. Applied at the same lazy hook points as the existing litellm repairs, plus the background preload, so merely importing pageindex still leaves the host's litellm untouched. Claude-Session: https://claude.ai/code/session_018psbiPrxdiCqFsS7Tk3eFL
llm_completion/llm_acompletion printed '* Retrying *' straight into stdout on every retried request — the channel that belongs to answers and CLI output. The notice moves to logging.warning beside the error line that already accompanies it. Claude-Session: https://claude.ai/code/session_018psbiPrxdiCqFsS7Tk3eFL
The banner mute grows into _quiet_litellm: litellm's own logger sprays WARNING records (remote-map fetch fallbacks, cost hiccups) onto stderr from inside requests — not actionable for SDK callers, whose real failures raise as exceptions. The preload stamps LITELLM_LOG=ERROR before litellm's import initializes its logger (setdefault, so an explicit caller choice wins, and litellm honors a chosen level itself); the hook's setLevel covers litellm imported before us, plus the dotted litellm namespace its adapters log under. Claude-Session: https://claude.ai/code/session_018psbiPrxdiCqFsS7Tk3eFL
…them _openai_agent asks litellm which provider serves a model twice (_openai_protocol, _cache_extra_args) before _openai_model flips suppress_debug_info, and openai_agent_config's litellm/ branch never flipped it at all; a managed cloud client runs no preload, so each failed lookup still print()ed the "Provider List:" banner. Quiet at the two get_llm_provider call sites instead, which covers every lane. Also: LITELLM_LOG at ERROR or above now clamps to that level (CRITICAL used to skip the clamp and end up noisier than unset); the retry notice is logged only when a retry follows; test_preload_stamps_litellm_log_level no longer leaks LITELLM_LOG=ERROR into the session; the config-time repair test covers _quiet_litellm with the preload thread pinned off. Claude-Session: https://claude.ai/code/session_01Gq5Kwi7wEgQNVT4k1XUhq9
…s itself now Since 30652ca each get_llm_provider caller and every completion helper flips the banner switch and clamps litellm's logger before touching litellm, so the background import's own _quiet_litellm() had no path left that depended on it; it was also the one place that mutated process-global logging at a moment the caller could not predict. The env stamps stay: import-time records still need them. The config-time repair test no longer needs the preload guard pinned. Claude-Session: https://claude.ai/code/session_01Gq5Kwi7wEgQNVT4k1XUhq9
… covers every lane _quiet_litellm() set litellm's loggers to ERROR on every entry, overriding whatever the host, litellm._turn_on_debug(), or LITELLM_LOG=DEBUG had set. It now sets a level only while a logger is still NOTSET: the default stays ERROR, anything set explicitly wins, and there is no per-call setLevel churn. LITELLM_LOCAL_MODEL_COST_MAP moves from the client's preload to utils' import. The CLI pipeline and openai_agent_config on a cloud client import litellm without the preload and fetched the remote model map on first use (offline: a WARNING). Every litellm lane imports utils first. The LITELLM_LOG=ERROR stamp is gone: it pinned litellm's stderr handler at ERROR for the whole process (silencing _turn_on_debug for good) while the logger level was what actually gated the chatter — output verified identical with and without it across plain, logging-configured, and debug hosts. Claude-Session: https://claude.ai/code/session_01CrSg9uRBvzVujNyU25Wmgk
_default_max_tokens is reached from anthropic_runner_config/messages(). On a managed cloud client the constructor never imports pageindex.utils, and local_chat deliberately keeps utils off its import path, so that lane imported litellm with LITELLM_LOCAL_MODEL_COST_MAP unset: the model cost map was fetched over the network (3517 entries vs the bundled 2982) and offline printed the very warning this branch removes. Verified end to end through the public API, before and after. Claude-Session: https://claude.ai/code/session_01CrSg9uRBvzVujNyU25Wmgk
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.
Review view only — do not merge. The base is the frozen commit
7d18cc0(main as of before this work landed), so this PR keeps the complete feature diff no matter how far main moves.Shipped in v0.2.13 — merged to main as ad7956d (originally #455, which carries the root-cause write-up).
Base branch
review/base-7d18cc0never advances; merging here would only pollute that branch, never main.