Skip to content

Streaming LiveBlock taller than the live window is evicted and its later updates are lost #14

Done

Description

@ThatRendle

Problem

A streaming ILiveBlock that grows taller than the live window is lost partway through.

In ScrollbackModel.PrePaint (src/Dcli/Internal/Scrollback/ScrollbackModel.cs, around line 215), when the live rows exceed maxHeight (Rows − fixed region), objects are committed from the front of the live list until it fits. That includes a LiveBlock that hasn't been committed yet. Its rows so far go to native scrollback and it leaves the live list. Later calls to AppendText, SetContent or Commit on its handle then change a detached object, so they never show.

Seen in dmon: a 2,091-character model reply showed cut off after about one screen.

Expected

An uncommitted LiveBlock is never dropped. When it overflows, the live window shows its newest rows, or flushes its top rows to scrollback and keeps the rest live. Its later updates and Commit still land, with no rows lost or duplicated.

Repro

  1. Headless terminal, 100×30.
  2. BeginLive().
  3. AppendText 10 short lines → LiveWindowRows is 1.
  4. AppendText ~400 words → LiveWindowRows is 0.
  5. AppendText("\nline 51") → LiveWindowRows is still 0, and the text never appears.

Also worth a look

AppendText renders \n as a space, so streamed text shows as one paragraph until SetContent replaces it. With the block evicted, that replacement never happens, so the reply stays flattened.

Downstream

dmon-core-next will bump dcli (currently 0.3.0-rc.0) and add a headless regression test once a release has the fix.

Activity

  1. added a commit that references this issue on Dec 2, 2026
  2. ThatRendle commented on Dec 2, 2026

    @ThatRendle
    ContributorAuthor

    Fixed in dcli 0.4.0, now on nuget.org (dcli and dcli.testing), via #16.

    What changed for consumers

    • An open ILiveBlock is never pushed into scrollback by overflow. If it's taller than the live window, the window shows its newest rows, and later AppendText / SetContent calls keep landing. Commit() sends the full final content to scrollback once, in order. The repro from this issue (100×30, 10 lines, ~400 words, then "\nline 51") is covered by a headless regression test.
    • Only the consumer commits. Several live blocks may be open at once, and dcli never commits one for you. An uncommitted block holds back everything appended after it from scrollback until it commits; nothing is lost. So call Commit() on every path, including errors and cancellation (e.g. in a finally).
    • BREAKING (behavioural): AppendText now treats \n and \r\n as line breaks, even when split across appends. A trailing \n adds no blank row. Streamed replies keep their paragraphs before SetContent.
    • An oversized ICollapsible expansion behind an open live block now waits for that block, so its lines don't land above it in scrollback.

    For dmon-core-next: bump dcli to 0.4.0 and add the planned headless regression test. Also check that every block in Transcript._live is committed on error, restart and cancellation paths: with this fix, a block that's never committed delays scrollback rather than losing text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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