Merge pull request #28829 from NousResearch/bb/tui-no-history-truncation

fix(tui): render full assistant text in scrollback (no history truncation)
This commit is contained in:
brooklyn!
2026-05-19 12:17:35 -05:00
committed by GitHub
parent 5a3317693c
commit b0af1d0931
8 changed files with 57 additions and 42 deletions

View File

@@ -1,7 +1,6 @@
import { describe, expect, it } from 'vitest'
import {
boundedHistoryRenderText,
boundedLiveRenderText,
buildToolTrailLine,
edgePreview,
@@ -160,15 +159,6 @@ describe('boundedLiveRenderText', () => {
})
})
describe('boundedHistoryRenderText', () => {
it('uses a non-live omission label for completed history', () => {
const out = boundedHistoryRenderText('abcdefghij', { maxChars: 4, maxLines: 10 })
expect(out).toContain('[showing tail; omitted')
expect(out).not.toContain('live tail')
})
})
describe('edgePreview', () => {
it('keeps both ends for long text', () => {
expect(edgePreview('Vampire Bondage ropes slipped from her neck, still stained with blood', 8, 18)).toBe(

View File

@@ -39,4 +39,19 @@ describe('virtual height estimates', () => {
expect(withSep).toBe(base + 2)
})
it('caps wrapped-line counting so giant assistant turns do not block offset rebuilds', () => {
// wrappedLines is invoked once per uncached message during
// useVirtualHistory's offset rebuild. Unbounded counting on a long
// assistant response (10k+ chars × every row × every rebuild) blocks
// the UI on cold mount. Cap is ~800 rows; post-mount Yoga
// measurement converges to the true height regardless.
const giant = 'x'.repeat(1_000_000)
const t0 = performance.now()
const rows = wrappedLines(giant, 80)
const elapsed = performance.now() - t0
expect(rows).toBeLessThanOrEqual(800)
expect(elapsed).toBeLessThan(50)
})
})