Skip to content

perf(tui): limit restored chat history to the viewport - #363

Open
0x7c13 wants to merge 1 commit into
openJiuwen-ai:mainfrom
0x7c13:perf/tui-history-viewport
Open

0x7c13 wants to merge 1 commit into
openJiuwen-ai:mainfrom
0x7c13:perf/tui-history-viewport

Conversation

@0x7c13

@0x7c13 0x7c13 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Paired: GitHub #363 ↔ GitCode !258

Changes

  • Restore the recent transcript first and mount older pages on demand. Keep layout work bounded to the viewport, nearby mounted pages, and the live tail.
  • Render history with the regular Textual message, Markdown, and tool widgets. Keep the current frame visible until a cold destination is ready. Coalesce superseded thumb requests and apply the latest request when the thumb is released.
  • Preserve reading position across resize, wheel input, page navigation, and TOC jumps. Keep document order for copying, prepare exact layout for selections across history, and preserve archive fold state separately from a continued turn.

Verification

  • The targeted TUI, replay, clipboard, installer, and architecture suites passed 3,273 tests locally. Ruff, formatting, and type checking passed for Linux, macOS, and Windows.

  • In tmux, a 1,500-turn restored session with all tools expanded passed eight drag landings, including held and immediate-release gestures, continuous wheel scrolling, and cold and warm TOC jumps.

  • The additional 1,500-turn matrix passed in three macOS tmux sizes and three Windows 11 ConPTY sizes. It covered track overshoot and reversal, resizing with the thumb held, keeping the pointer stationary after resize, and switching from drag to wheel, Page Up/Down, and TOC navigation. The Windows x64 Python environment also passed 253 focused replay, input, and selection tests.

  • All 20 GitHub Actions jobs passed on the final commit. CI run

240-turn tmux comparison

One matched run per version on macOS using the same restored session, terminal size sequence, and input sequence. UI timings measure input to terminal output. Stream timings measure mock provider delivery to the expanded reply appearing in the terminal.

Metric main at 4a3acd3f This PR
Resize, median 169 ms 26 ms
Sidebar toggle, median 271 ms 16 ms
Expanded streaming reply, median per update 173 ms 109 ms
Page Up, median 10.4 ms 9.8 ms
Page Down, median 5.3 ms 5.1 ms
Last drag motion to final frame, median / p95 115 / 134 ms 65 / 113 ms
Mounted chat descendants after replay settles 4,563 79
Process RSS after replay settles 317 MiB 212 MiB

The first Page Up that mounted a cold page took 56 ms. After opening all tools in the 1,500-turn session, the first four drag destinations took 156–312 ms to settle. Repeating the gestures took 63–147 ms.

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 50454a867cf48ef257f8b976d871f94f40d56a73

🤖 正在生成合并请求摘要,请稍候…

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 50454a867cf48ef257f8b976d871f94f40d56a73

🤖 AI 代码检视正在进行中,请稍候…

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 50454a867cf48ef257f8b976d871f94f40d56a73

⚠️ 本次变更过大(30 个可审文件、4380 行,预估需 4 轮分片审查),已超出 AI 代码评审的处理范围,本次跳过。建议拆分为更小的 PR 以获得有效评审。

1 similar comment
@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 50454a867cf48ef257f8b976d871f94f40d56a73

⚠️ 本次变更过大(30 个可审文件、4380 行,预估需 4 轮分片审查),已超出 AI 代码评审的处理范围,本次跳过。建议拆分为更小的 PR 以获得有效评审。

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 50454a867cf48ef257f8b976d871f94f40d56a73

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: a8db106d8ea63c1d48f2fedc91fcf6b139b69ce4

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 58640de00d1ff4f719405f278f64b90af67b3295

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: f7905b92c8f4f2510e79d15771d0813e2f69c7f4

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A

@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 6ab09f9636e4cf99486e8a19b9db791d2228d59c

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A

Mount archived pages on demand and render every viewport with the regular
Textual transcript widgets. Preserve reading anchors, folding, selection,
and copy order across lazy mounts.

Exercise cold and warm history navigation, and make related platform
tests deterministic under CI load.
@0x7c13
0x7c13 force-pushed the perf/tui-history-viewport branch from 6ab09f9 to 4e746e9 Compare November 27, 2026 16:07
@openjiuwen-collaboration-bot

Copy link
Copy Markdown
Contributor

head_sha: 4e746e98d9675ca00ec35d626f003d5e7230198b

任务名称 结果 日志操作
静态检查 ✅SUCCESS 点此跳转
禁用词扫描 ✅SUCCESS 点此跳转
防投毒检查 ✅SUCCESS 点此跳转
开源合规检查 ✅SUCCESS 点此跳转
UT测试 ✅SUCCESS 点此跳转
ST测试 N/A N/A
build 编译包 N/A N/A
ruff codecheck ✅SUCCESS N/A
issue关联检查 N/A N/A
pr size检查 N/A N/A

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant