Skip to content

AttributeError in console() with rich >= 14.3.0: LiveRender missing 'last_render_height' #268

@dfalbel

Description

@dfalbel

Description

Calling chat.console() crashes with an AttributeError when using rich >= 14.3.0.

The root cause is that chatlas monkeypatches Live._live_render with its own LiveRender class (in chatlas/_live_render.py) to add crop_above support. However, rich 14.3.0 added a new last_render_height property to its own LiveRender (in Textualize/rich#3934) and Live.stop() now accesses self._live_render.last_render_height. Since chatlas's custom LiveRender doesn't have this property, it crashes.

Reproducible example

from chatlas import ChatOpenAI
chat = ChatOpenAI()
chat.console()
# Type any message and press Enter

Traceback

Traceback (most recent call last):
  File "examples/simple_chat.py", line 14, in <module>
    chat.console()
  File ".../chatlas/_chat.py", line 831, in console
    self.chat(user_input, echo=echo, stream=stream, kwargs=kwargs)
  File ".../chatlas/_chat.py", line 1081, in chat
    with display:
  File ".../chatlas/_chat.py", line 3171, in __exit__
    result = self._display.__exit__(*args, **kwargs)
  File ".../chatlas/_display.py", line 99, in __exit__
    return self.live.__exit__(exc_type, exc_value, traceback)
  File ".../rich/live.py", line 193, in __exit__
    self.stop()
  File ".../rich/live.py", line 172, in stop
    and self._live_render.last_render_height
AttributeError: 'LiveRender' object has no attribute 'last_render_height'

Root cause

In chatlas/_display.py:64, live._live_render is replaced with chatlas's own LiveRender (from chatlas/_live_render.py). This custom class doesn't define last_render_height, which rich's Live.stop() now relies on since Textualize/rich#3934 (included in rich 14.3.0).

Environment

  • chatlas: 0.15.1
  • rich: 14.3.2
  • Python: 3.13
  • OS: macOS (Darwin 24.5.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions