You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Still reproducing this on kimi-code 0.23.1 under Windows PowerShell.
Symptom: while a turn is running and producing output, the terminal view suddenly jumps back to the very top of the conversation. I have to manually scroll back down to see the latest output. This happens repeatedly during a session, not just once.
Environment:
Kimi Code: 0.23.1
OS: Windows 11
Terminal: Windows PowerShell (not Windows Terminal, plain PowerShell console)
Install source: native Windows binary via install.ps1
It seems the same fullRender(true) / viewport-tracking issue described above also affects PowerShell, not only Git Bash. Happy to provide screenshots or a screen recording if that helps.
+1, same issue here.\n\nEnvironment:\n- OS: Windows 11 25H2\n- Terminal: PowerShell 7\n- Kimi Code: 0.29.0\n\nSymptoms:\nWhen the model finishes the thinking phase and switches to rendering the assistant text, the terminal suddenly jumps back to the very top of the entire session. I have to manually scroll back to the bottom to see the latest output. This happens frequently, especially in long conversations.\n\nConsistent with the analysis in #981, it seems that the firstChanged < prevViewportTop -> fullRender(true) branch in pi-tui 0.74.0 is being incorrectly triggered when the ThinkingComponent switches state, causing a clear-screen sequence and a re-render from the top.\n\nNote: After upgrading to 0.29.1, I haven't reproduced this yet. Not sure if it was fixed or if the trigger conditions changed, just sharing for reference.
I ran into the "TUI jumps to the top" problem and tried to narrow down which path actually causes it on my machine. Two observations that might be useful.
1. Which path reaches fullRender(true)
I ran a normal session with PI_DEBUG_REDRAW=1. Over ~9 minutes I got 7 destructive full redraws, and none of them were firstChanged < viewportTop:
I never resized the window. The -1 is the sentinel from requestRender(force) in packages/pi-tui/src/tui.ts (the comment there says -1 triggers widthChanged, forcing a full clear, so that part is working as designed). kimi-code calls requestRender(true) in a number of ordinary places: closing the autocomplete menu, opening/closing the approval preview, Ctrl+O, panel open/close, theme switch. #2296 looks like the same path.
So at least on my machine, the analysis in this issue and the open PRs around the firstChanged < prevViewportTop branch may be looking at a different path from the one that actually fires. The log line also reads "terminal width changed" for these, which is easy to misread as a real resize.
2. Which part of the redraw causes the jump
I replayed the exact byte sequence fullRender(true) emits (ESC[?2026h + ESC[2J ESC[H ESC[3J + rewrite of the whole buffer + ESC[?2026l) from a small node script, scrolled up a few screens before it fired, and compared variants:
ESC[3J alone, no rewrite afterwards: view jumps to the bottom — harmless
the full sequence with ESC[3J: view jumps to the top — reproduces the bug
the same sequence without ESC[3J: view stays put — but the old content remains in scrollback, so each redraw appends a duplicate copy of the buffer
So on this terminal it's specifically the combination "erase scrollback + rewrite the whole buffer" that yanks the view, and dropping ESC[3J just trades the jump for duplicated scrollback. I understand that's the trade-off space #1367 already dealt with, so I'm not suggesting a direction — just reporting what each variant does.
Environment: kimi-code 0.29.1, Windows 10, Windows Terminal 1.24.11911.0. This is one machine, so I'd be curious whether others see the same split in their PI_DEBUG_REDRAW logs (~/.pi/agent/pi-debug.log).
Activity
li-xiu-qi commentedon Jun 22, 2026
根因确认
Issue 的分析完全准确。经过对
@earendil-works/pi-tui源码的交叉验证:1. 0.74.0 第 909 行确实存在
firstChanged < prevViewportTop->fullRender(true)2. 0.74.0 已包含 0.51.1 和 0.63.0 的修复
prevViewportTop计算已使用this.previousViewportTop而非 stalemaxLinesRendered。3. 升级到 0.79.10 不会修复此问题
0.79.10 在
doRender核心逻辑上与 0.74.0 完全一致,firstChanged < prevViewportTop分支一字未改。4. ThinkingComponent finalize 触发链确认
streaming-ui.ts的onThinkingEnd()->finalize()->requestRender()->doRender()->firstChanged < prevViewportTop->fullRender(true)。上游参考
pi-tui 已有专门的 Issue 讨论此问题,并给出了修复方案:
firstChanged < prevViewportTop(变更在视口上方)时,不要触发fullRender(true),只更新内部状态并跳过重绘。修复方向
短期:在 kimi-code 中用
pnpm patch对 pi-tui 打补丁。根本:推动 pi-tui 上游合入 #4506 的修复方案,然后 kimi-code 升级 pi-tui 依赖。
li-xiu-qi commentedon Jun 22, 2026
补充:pi-tui #4506 的状态
pi-tui 的 Issue #4506 已在 2026-05-14 被 github-actions bot 自动关闭,原因是项目当时正在进行大规模重构,期间所有 issue 自动关闭。关闭评论原文:
现在重构期已过(已 6 月),但该 issue 未被重新打开,修复方案尚未合入。0.79.10 仍存在此 bug。
因此 kimi-code 短期修复仍然需要自行 patch pi-tui。
li-xiu-qi commentedon Jun 22, 2026
补充:pi-tui 上游相关 Issue 汇总
在 pi-tui 仓库中搜索到多个描述同一问题的 issue:
--no-extensions仍存在关键发现:
firstChanged < prevViewportTop时只更新状态,不触发 fullRender),但被重构期 bot 关闭后未重开li-xiu-qi commentedon Jun 22, 2026
综合调查结论
1. 根因确认
Issue 分析完全准确。经过对
@earendil-works/pi-tui源码的交叉验证:firstChanged < prevViewportTop→fullRender(true)导致清屏跳顶prevViewportTop计算已使用this.previousViewportTop而非 stalemaxLinesRendered)doRender核心逻辑上与 0.74.0 完全一致,firstChanged < prevViewportTop分支一字未改onThinkingEnd()→finalize()→requestRender()→doRender()→firstChanged < prevViewportTop→fullRender(true)2. pi-tui 上游 Issue 汇总
在 pi-tui 仓库中发现多个描述同一问题的 issue,均未修复:
firstChanged < prevViewportTop关键事实:维护者 mitsuhiko 在 #5576 中表示无法复现,但多个用户在不同平台(Windows Terminal、Termux)确认存在。没有任何修复 PR 合入 pi-tui。
3. 修复方向
短期:在 kimi-code 中用
pnpm patch对 pi-tui 打补丁,将firstChanged < prevViewportTop分支的fullRender(true)替换为只更新内部状态(previousLines、prevViewportTop等)并跳过重绘。变更在视口上方用户看不到,更新内存即可。根本:推动 pi-tui 上游合入 #4506 的修复方案,然后 kimi-code 升级 pi-tui 依赖。
docs: add changeset for MoonshotAI#981 viewport fix
fix(tui): prevent viewport jump when thinking finalizes above viewport
docs: add changeset for MoonshotAI#981 viewport fix
ieasir commentedon Jul 7, 2026
Still reproducing this on kimi-code 0.23.1 under Windows PowerShell.
Symptom: while a turn is running and producing output, the terminal view suddenly jumps back to the very top of the conversation. I have to manually scroll back down to see the latest output. This happens repeatedly during a session, not just once.
Environment:
It seems the same
fullRender(true)/ viewport-tracking issue described above also affects PowerShell, not only Git Bash. Happy to provide screenshots or a screen recording if that helps.skywalker-35 commentedon Jul 25, 2026
+1, same issue here.\n\nEnvironment:\n- OS: Windows 11 25H2\n- Terminal: PowerShell 7\n- Kimi Code: 0.29.0\n\nSymptoms:\nWhen the model finishes the thinking phase and switches to rendering the assistant text, the terminal suddenly jumps back to the very top of the entire session. I have to manually scroll back to the bottom to see the latest output. This happens frequently, especially in long conversations.\n\nConsistent with the analysis in #981, it seems that the
firstChanged < prevViewportTop -> fullRender(true)branch in pi-tui 0.74.0 is being incorrectly triggered when the ThinkingComponent switches state, causing a clear-screen sequence and a re-render from the top.\n\nNote: After upgrading to 0.29.1, I haven't reproduced this yet. Not sure if it was fixed or if the trigger conditions changed, just sharing for reference.zbl1998-sdjn commentedon Jul 31, 2026
I ran into the "TUI jumps to the top" problem and tried to narrow down which path actually causes it on my machine. Two observations that might be useful.
1. Which path reaches
fullRender(true)I ran a normal session with
PI_DEBUG_REDRAW=1. Over ~9 minutes I got 7 destructive full redraws, and none of them werefirstChanged < viewportTop:I never resized the window. The
-1is the sentinel fromrequestRender(force)inpackages/pi-tui/src/tui.ts(the comment there says-1 triggers widthChanged, forcing a full clear, so that part is working as designed). kimi-code callsrequestRender(true)in a number of ordinary places: closing the autocomplete menu, opening/closing the approval preview, Ctrl+O, panel open/close, theme switch. #2296 looks like the same path.So at least on my machine, the analysis in this issue and the open PRs around the
firstChanged < prevViewportTopbranch may be looking at a different path from the one that actually fires. The log line also reads "terminal width changed" for these, which is easy to misread as a real resize.2. Which part of the redraw causes the jump
I replayed the exact byte sequence
fullRender(true)emits (ESC[?2026h+ESC[2J ESC[H ESC[3J+ rewrite of the whole buffer +ESC[?2026l) from a small node script, scrolled up a few screens before it fired, and compared variants:ESC[3Jalone, no rewrite afterwards: view jumps to the bottom — harmlessESC[3J: view jumps to the top — reproduces the bugESC[3J: view stays put — but the old content remains in scrollback, so each redraw appends a duplicate copy of the bufferSo on this terminal it's specifically the combination "erase scrollback + rewrite the whole buffer" that yanks the view, and dropping
ESC[3Jjust trades the jump for duplicated scrollback. I understand that's the trade-off space #1367 already dealt with, so I'm not suggesting a direction — just reporting what each variant does.Environment: kimi-code 0.29.1, Windows 10, Windows Terminal 1.24.11911.0. This is one machine, so I'd be curious whether others see the same split in their
PI_DEBUG_REDRAWlogs (~/.pi/agent/pi-debug.log).