fix(terminal): 修复 Windows 旧系统 Codex CLI 清屏后滚动历史丢失问题 - #447
Merged
J3n5en merged 2 commits intoJul 21, 2026
Conversation
Contributor
|
I'll analyze this and get back to you. |
J3n5en
requested changes
Jul 21, 2026
J3n5en
left a comment
Owner
There was a problem hiding this comment.
暂缓合并,有两处功能范围问题需要先修正:\n\n1. 初始值固定为 ,迁移逻辑也只接受已有的 ,代码中没有 Windows build 判断。因此 PR 描述所称“Windows 10/旧版默认启用、Windows 11 25H2+ 默认关闭”并未实现,现有用户升级后修复不会自动生效。\n2. 对所有平台、所有终端、且无论兼容开关是否开启都会生效。该选项会把 ED2 清屏内容推入 scrollback,改变 macOS/Linux 和普通终端的清屏语义,与“macOS/Linux 不受影响”不符。建议至少与 Windows 兼容开关绑定,或拆成独立且明确的终端设置。\n\n补充:node-pty 1.1.0 自带 ,已在 Windows 将相同的 ConPTY 文件复制到 ;新增准备脚本目前属于重复保障,不是本次阻塞项。
J3n5en
reviewed
Jul 21, 2026
J3n5en
left a comment
Owner
There was a problem hiding this comment.
补充完整标识符:
windowsConptyCompatibilityFixEnabled初始值固定为false,迁移逻辑也只接受已有的true,代码中没有 Windows build 判断。因此 PR 描述中的旧版 Windows 默认启用并未实现。scrollOnEraseInDisplay: true对所有平台、所有终端、且无论兼容开关是否开启都会生效,会改变 ED2 清屏语义。建议与 Windows 兼容开关绑定,或拆成独立设置。- node-pty 1.1.0 自带
scripts/post-install.js,已复制相同资源到build/Release/conpty;新增准备脚本属于重复保障,不是阻塞项。
- 引入随包 ConPTY/OpenConsole,通过设置开关按需启用 useConptyDll - 新增 scripts/prepare-node-pty-conpty.mjs 在 postinstall 与 Windows 构建时拷贝运行时 - electron-builder.yml 将 conpty 相关文件加入 asarUnpack,确保打包后可用 - PtyManager spawn 失败时自动回退,避免兼容开关导致无法启动终端 - xterm 启用 scrollOnEraseInDisplay,配合新 ConPTY 保留清屏后回滚内容 - 新增设置项及中文文案,Windows 25H2 以下版本可开启开关
J3n5en
force-pushed
the
fix/terminal-windows-conpty-compatibility
branch
from
July 21, 2026 02:21
0b2b420 to
48bd34d
Compare
J3n5en
approved these changes
Jul 21, 2026
J3n5en
left a comment
Owner
There was a problem hiding this comment.
复审通过。已补齐 Windows build 26200 分界的默认策略,迁移逻辑会保留用户明确选择,并将 scrollOnEraseInDisplay 与 Windows 兼容开关绑定;原先两项阻塞问题均已解决。建议合并。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

问题描述
在 Windows 10 及更旧的 Windows 系统上,Codex CLI 会话在清屏重绘后会出现:
解决方案
通过 node-pty 的 useConptyDll 选项加载随包新版 conpty.dll 和 OpenConsole.exe,规避旧系统 ConPTY 的已知问题。
技术实现
改动文件 (15 个文件,+252/-5)
修改文件:
测试结果
✅ 11 个测试文件全部通过
✅ 66 个测试用例全部通过
✅ 包含 4 个新增的 Windows ConPTY 相关测试
验证计划
风险评估