Repository navigation
Description
Where
Windows
What happened
ELYTerminal 0.2.6(%LOCALAPPDATA%\Programs\ELYTerminal\elyterminal.exe),Windows 11 build 26300,x64。
其旁边的 conpty.dll 与 OpenConsole.exe 为 1.25.260930003(vendor/conpty/x86_64 随包那份)。
出问题的链路是 pi 1.5.2 → herdr 0.9.5 → ELYTerminal;图片协议为 kitty graphics。
同样的内容不经过 herdr、直接在普通 ELYTerminal pane 里输出则一切正常。
我用一个最小探针(下面 Steps to reproduce 里那段,不依赖任何第三方库)复现,并开了 RUST_LOG=elyterminal=debug 抓日志。
数据流是这样的:程序用 a=T,f=100(PNG)画图 → herdr 在自己的 libghostty pane 里解码 → herdr 以原始 RGBA 重新转发给宿主终端,格式为a=t,t=d,f=32,s=W,v=H,i=ID,q=2,按 4096 个 base64 字符分块 → 之后每帧重放a=p,i=ID,p=PID,c=…,r=…,z=…,C=1,q=2 的 placement。
对一张 1024×768 的图,日志显示 1024 条分块命令都抵达了 ELYTerminal,但最后一条短了 18 个 base64 字符:
DEBUG graphics 8984: 4143 bytes at 55, 74: a=t,t=d,f=32,s=1024,v=768,i=1077689861,q=2,m=1;…
DEBUG graphics 8984: 4100 bytes at 55, 74: m=1;… × 1022
DEBUG graphics 8984: 4082 bytes at 55, 74: … ← 少了 18 个 base64 字符
WARN graphics 8984: a command drops: the payload is no base64: Base64Error
WARN graphics 8984: 1024x768 at 4 bytes needs 3145728, not 3142656
3142656 = 1023 × 3072,也就是整整改丢一块;那 18 个字符让 base64 不合法。ELYTerminal 按 kitty 规范丢弃整条传输,图从未入库。而 herdr 因为传的时候带 q=2(静默),以为图已上传成功,于是只重放 placement,每一条都得到:
WARN graphics 8984: Ids { id: 1077689861, number: 0, placement: 151925 } fails: ENOENT: image not found × 56
图再也回不来,一直空白,直到 herdr 删掉这个 id(a=d,d=I,i=1077689861,q=2)。
排查结论:这不是 ELYTerminal 的解析或绘制问题。同样三张图(3.1 KB / 1 个 APC、263 KB / 64 个 APC、4.2 MB / 1024 个 APC),由普通程序在普通
ELYTerminal pane 里直接输出,全部都能画出来,包括那张 4 MB 的。所以 vte 的 APC 分发、alacritty fork 的 Graphics 回调、分块拼装、base64 解码和绘制都能处理 4 MB 的流
把 elyterminal.exe 旁边那对 conpty.dll + OpenConsole.exe 换成 1.24.261001001(NuGet Microsoft.Windows.Console.ConPTY,取runtimes/win-x64/native/conpty.dll 与 build/native/runtimes/x64/OpenConsole.exe),同一张 1024×768 的探针在 herdr pane 里就能正常画出,日志里不再有drops、也不再有 needs … not …。两个 DLL 导出的 14 个符号完全相同(ConptyPackPseudoConsole、ConptyClearPseudoConsole 都在),所以默认终端接管与 Clear不受影响。
这与 herdr#5657 报的是同一对版本,他们那边的 A/B 只改宿主终端的 ConPTY:1.24.261001001 六次全干净,1.25.260930003 七次全失败。
需要说明的是,本文只证明了字节丢在「herdr 写出」与「ELYTerminal 读到」之间、且换掉 ConPTY 会改变结果;换 DLL 必须重启ELYTerminal,同时也重启了
herdr 客户端,所以 herdr 每帧的 transaction_budget(按字节边界裁剪图形输出)无法排除在剪切者之外。但一个普通写入者经同一个 1.25 ConPTY 送 4 MB 是干净的,说明这不是单纯的「长度上限」,更像是 herdr 那种交错的 TUI 输出触发了它。
Steps to reproduce
-
在 ELYTerminal 里开两个 pane:一个普通 pwsh,一个运行 herdr,在 herdr 的 pane 里再开一个 shell。
2. 带日志启动 ELYTerminal:
$env:RUST_LOG = "elyterminal=debug,ely_gpui_component=info"
Start-Process -FilePath "$env:LOCALAPPDATA\Programs\ELYTerminal\elyterminal.exe" -RedirectStandardError "$env:TEMP\ely.log"
3. 把下面这段存成 kitty-big.py 并运行:python kitty-big.pyimport base64, sys w, h = 1024, 768 px = bytes(v for y in range(h) for x in range(w) for v in (x * 255 // (w - 1), y * 255 // (h - 1), 128, 255)) body = base64.b64encode(px).decode() out, first = sys.stdout.buffer, True while body: piece, body = body[:4096], body[4096:] head = (f"a=T,f=32,s={w},v={h},i=1,q=2,c=48,r=36" + (",m=1" if body else "")) \ if first else ("m=1" if body else "m=0") out.write(f"\x1b_G{head};{piece}\x1b\\".encode()) first = False out.write(b"\r\n" * 35 + b"=== blank = the image never painted ===\r\n") out.flush()它共 1024 个 APC、约 4.2 MB;把 w, h 改成 24, 24(并把 c/r 改成 6/6)则只有 1 个 APC、3.1 KB,用来对照。
- 先在最前面的那个普通 pane 里跑一次:图片正常显示(这是对照组,不需要 herdr)。
- 再在 herdr 的 pane 里跑一次:出现一块空白矩形,图片不显示。
- 读日志:Select-String -Path "$env:TEMP\ely.log" -Pattern "needs|drops|fails" | Select-Object -Last 20
What you expected
herdr pane 里的图片应该和普通 pane 里一样正常显示,而不是只留下空白行。
pi的输出不再静默丢失图片
建议
把 vendor/conpty 降到 1.24.261001001,x86_64 与 aarch64 一起,直到 herdr#5657 或
microsoft/terminal#19621 关闭为止;
Commit or version
最新released 0.2.6
Logs
RUST_LOG=elyterminal=debug,ely_gpui_component=info
日志文件:%TEMP%\ely.log
--- 对照:普通 pane 里同样的 4.2 MB / 1024 个 APC —— 正常 ---
DEBUG elyterminal::term::graphics] graphics 53948: 4143 bytes at …: a=T,f=32,s=1024,v=768,i=1,q=2,c=48,r=36,m=1;…
DEBUG elyterminal::term::graphics] graphics 53948: 4100 bytes at …: m=1;… × 1022
DEBUG elyterminal::term::graphics] graphics 53948: 4082 bytes at …: m=0;…
DEBUG elyterminal::term::graphics::put] graphics 53948: image 1 placed Grid at 55, 0 over 48 by 36 cells
(屏幕正常显示渐变图)
--- herdr pane(pty 8984)里同一张图 —— 空白 ---
DEBUG elyterminal::term::graphics] graphics 8984: 4143 bytes at 55, 74: a=t,t=d,f=32,s=1024,v=768,i=1077689861,q=2,m=1;AACA/wAAgP8AAID/A
DEBUG elyterminal::term::graphics] graphics 8984: 4100 bytes at 55, 74: m=1;AoD/AAAEgP8BBID/AgSA/wMEgP8EBID/BQSA/wYEgP8HBID/CASA/wkEgP
…(共 1022 条 4100 字节的 m=1 分块)
DEBUG elyterminal::term::graphics] graphics 8984: 4082 bytes at 55, 74: m=0;…
WARN elyterminal::term::graphics] graphics 8984: a command drops: the payload is no base64: Base64Error
WARN elyterminal::term::graphics::load] graphics 8984: 1024x768 at 4 bytes needs 3145728, not 3142656
WARN elyterminal::term::graphics] graphics 8984: Ids { id: 1077689861, number: 0, placement: 151925 } fails: ENOENT: image not found
(上面那条 ENOENT 连续出现 56 次,直到)
DEBUG elyterminal::term::graphics] graphics 8984: 25 bytes at 52, 26: a=d,d=I,i=1077689861,q=2;
DEBUG elyterminal::term::graphics] graphics 8984: delete Image { id: 1077689861, placement: 0 }
--- herdr pane 里的小图(24×24,单块)—— 正常 ---
DEBUG elyterminal::term::graphics] graphics 8984: 3116 bytes at 55, 64: a=t,t=d,f=32,s=24,v=24,i=1077689861,q=2,m=0;AACA/wsAgP8WAID/IQCA
DEBUG elyterminal::term::graphics::put] graphics 8984: image 1077689861 placed Grid at 55, 0 over 6 by 6 cells
--- 换 ConPTY 之后 ---
INFO elyterminal::term::pty] pty: ConPTY is C:\Users\…\AppData\Local\Programs\ELYTerminal\conpty.dll
(同一条 1024×768 命令在 herdr pane 里正常显示;日志里无 drops、无 needs … not …、无 ENOENT)
Activity
T222: ConPTY back to 1.24.261001001, which herdr's kitty graphics pas…
Raiden-MeixElysia commentedon Nov 24, 2026
0.2.7 已修复:随包附带的 ConPTY 回到 1.24.261001001(x86_64 和 ARM64 都是)。
在 Windows 上(build 26200)用你的复现方式经 herdr 测过:1.25.260930003 和 1.25.261109001 下三张图一张都没画出来,1.24 下三张都画出来了。同样的数据流由普通程序直接输出时,两个版本都正常。ConPTY 的鼠标模式、kitty 图形和 CSI 16 t 测试在 1.24 上全部通过。
等 microsoft/terminal#19621 修复后,会再换回 1.25。
T237: 0.2.7 released with every build, the cask and winget following;…