Skip to content

bug(tui): importing LiteLLM prints over the TUI's rendering #276

Description

@0xKT

Summary

The first action that reaches LiteLLM prints to the terminal underneath the TUI's
own rendering, and the screen stays unreadable until something forces a full redraw.

_strip_tty_stream_handlers removes the handlers that write to the terminal at
startup, but LiteLLM is imported lazily, after that -- and its import installs its
own stderr handler. The root logger's level is 0, so DEBUG records pass as well.

Steps to reproduce

  1. Run raven tui.
  2. Type /model.
  3. Open a provider whose model list is not cached yet, so LiteLLM is imported.

Expected behavior

Nothing LiteLLM logs reaches the terminal while the TUI owns it. The log file under
~/.raven already exists and is the destination.

Actual behavior

Log lines land mid-render and the layout is broken until the next full redraw.

Logs or screenshots

LiteLLM:WARNING: common_utils.py:979 - litellm: could not pre-load bedrock-runtime
response stream shape - Bedrock event-stream decoding will be unavailable.
Error: No module named 'botocore'

Environment

OS: macOS 26.5 (arm64)
Shell: zsh
Python: 3.12.12
Node: v24.14.0
Raven: 3087174 (origin/main)
Install: source checkout, uv sync
litellm: 1.85.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions