Repository navigation
fix(desktop): 固定 Core #169,WSL 没装的发行版说明无法连接、未知用户带 wsl.exe 的消息,补真实主机验收测试 (#2231) - #2300
Merged
Merged
Conversation
…测试 (#2231) #2299 合入后在真实主机上做 #43c 验收时发现两个问题: - wsl.exe 把失败写在标准输出,Core 只读标准错误。连接一个没装的发行版 因此报成 failed,诊断只有退出码。固定版本升到 Core #169 的 edad041: 没装的发行版是 unreachable,未知用户是 failed,诊断都带 wsl.exe 的原文。 注释补上 #2299 漏写的 18feb4a(#167)一行。 - workbench 的测试内核没有替换 RemoteListWSLDistributions,在装了 WSL 的 Windows 上,远程开发窗口会列出本机真实的发行版,导致测试失败。testKernel 改为返回空列表,remoteProbeKernel 改为嵌入 testKernel。 新增 desktop/internal/core/remote_acceptance_test.go,只在环境变量指定真实 SSH 主机或 WSL 发行版时运行:杀掉传输子进程模拟断线,确认 resume 后能接回 运行;“保留”关闭后重连,确认能接回进程;另外检查 WSL 两种失败的分类。 macOS(OrbStack Alpine aarch64,经 OpenSSH)和 Windows(WSL Ubuntu x86_64) 均已通过。矩阵和 Agent Note 记入验收结果。
1 task done
xiaoyumuxi
marked this pull request as ready for review
November 22, 2026 05:39
This was referenced Nov 22, 2026
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.
关联 Issue / Linked issue
edad041)PR 类型 / Type
改动说明 / What changes
背景 / Why
#2299 合入后,我在真实主机上做了 #43c 的验收:macOS 经 OpenSSH 连 OrbStack 的 Alpine aarch64 机器,Windows 连本机的 WSL Ubuntu x86_64。断线后接回运行、“保留”关闭后接回进程,两端都正常。但 Windows 上暴露了两个问题:
unreachable),并带上 wsl.exe 的说明。原因是 wsl.exe 把失败消息写在标准输出,Core 却只读标准错误。中文系统上还有一个问题:中文消息以汉字开头,UTF-16 的识别规则认不出来,会解成乱码。Core fix(windows/theme): 修复Windows深色模式下文字不可读 (#148) #169 修好了这两处。RemoteListWSLDistributions,调用直接落到真实 Core,于是窗口里列出了本机真实的发行版,断言和截图都随机器变化。改动 / Changes
Core 固定版本
scripts/desktop/build-desktop-core.sh:PINNED_CORE_REVISION从 Core main18feb4a升到 Core fix(windows/theme): 修复Windows深色模式下文字不可读 (#148) #169 的分支提交edad041。fix(windows/theme): 修复Windows深色模式下文字不可读 (#148) #169 基于18feb4a,只改 WSL 失败的读取方式。18feb4a(fix-issue-159:修复 Mac 端 PR 与 Git 窗口切换卡顿问题 #167,remote.attachProcess)那一行,feat(desktop): 远程工作区的运行在断线重连后接着输出,关闭时保留的进程可在运行窗口接回 (#2231) #2299 升级固定版本时漏写了;另加一行说明edad041来自尚未合入的 fix(windows/theme): 修复Windows深色模式下文字不可读 (#148) #169。Wsl/Service/WSL_E_DISTRO_NOT_FOUND)报unreachable,其他失败(例如用户不存在,Wsl/WSL_E_USER_NOT_FOUND)报failed,诊断是 wsl.exe 的原文;Core 客户端文档
desktop/internal/core/remote_session.go:RemoteConnect的注释补上“已安装发行版里不存在的用户是RemoteProbeFailed,诊断是 wsl.exe 打印的内容”。只改注释,代码没变。真实主机验收测试(新增)
desktop/internal/core/remote_acceptance_test.go:只在环境变量指定真实主机时运行,CI 和没设变量的机器上直接跳过。变量写在文件开头:LITHE_TEST_REMOTE_SSH_HOST,可选_PORT、_USER、_KEY;LITHE_TEST_REMOTE_WSL_DISTRO,可选_USER。测试要经
scripts/desktop/desktop-go.sh运行,这样才能读到暂存的服务端产物。TestRemoteAcceptanceRunsSurviveALostConnectionAndAKeptClose:connection_closed结束;resume重连,确认回到同一个主机会话;remote.attachProcess接回,确认先收到断线期间的输出、再收到之后的输出,并以 0 退出;keptPrograms里,并能同样接回。TestRemoteAcceptanceWSLRefusesAnAbsentDistributionAndUser:没装的发行版是unreachable,不存在的用户是failed,诊断里分别带WSL_E_DISTRO_NOT_FOUND、WSL_E_USER_NOT_FOUND,两种情况都不开会话。诊断里有发行版名和用户名,所以失败时只输出“错误码是否出现”。workbench 测试与本机 WSL 隔离
desktop/internal/workbench/app_test.go:testKernel新增RemoteListWSLDistributions,返回空列表,相当于 Core 在没有 WSL 的系统上的回答。这样窗口在任何测试机器上看起来都一样。desktop/internal/workbench/remote_test.go、remote_connections_visual_test.go:remoteProbeKernel改为嵌入*testKernel。原来它只嵌入*core.Client,没有覆盖的方法会落到真实 Core。矩阵和 Agent Note
shared/platform-feature-matrix/features/remote-workspace.json:验证步骤写入真实主机验收的做法和 2026-11-22 两端的结果,并说明依赖 Core fix(windows/theme): 修复Windows深色模式下文字不可读 (#148) #169;macOS、Windows 的证据都加上remote_acceptance_test.go。整机交互验收没做,两端的验证状态不变。.agents/notes/implemented/architecture/2026-11-22-remote-workspace-process-runs.md:验证一节补两条:不在本 PR 范围内 / Out of scope
edad041换成 Core main 上的对应提交。这件事需要单独一个小 PR,或者在本 PR 合入前补上。类型专属:fix
复现与根因
remote.connect时让wsl.distribution指向一个没装的名字)。status是failed,diagnostics是 "wsl.exe exited with status …"。unreachable,diagnostics带 wsl.exe 的消息和WSL_E_DISTRO_NOT_FOUND。failed,诊断带WSL_E_USER_NOT_FOUND。5c163e9)加入 WSL 连接时,classify_wsl只读标准错误,单元测试里的假 wsl.exe 也把消息写在标准错误,和真实行为不一致。我在 Windows 上分别抓了两个输出流,确认 wsl.exe 把失败写在标准输出;不设WSL_UTF8时是不带 BOM 的 UTF-16LE。818cdd428)引入:远程开发窗口开始列出本机发行版,测试内核却没有替换这个调用。检查项
desktop/internal/core/remote_acceptance_test.go的TestRemoteAcceptanceWSLRefusesAnAbsentDistributionAndUser:Core 还是18feb4a时,在 Windows 上没装的发行版报status = "failed";固定到edad041后通过。-run Remote,修复前远程开发窗口的测试因为列出本机发行版而失败,修复后通过。LaunchError::NoShell和classify_wsl的调用方都在 Core 的remote、workspace两个 crate 里,fix(windows/theme): 修复Windows深色模式下文字不可读 (#148) #169 已全部改过。桌面端只通过RemoteConnect读取status和diagnostics,字段和取值都没有变。RemoteListWSLDistributions在 workbench 测试里的调用都经过testKernel。rust/contracts/rust-core-api.md(在 fix(windows/theme): 修复Windows深色模式下文字不可读 (#148) #169 里改)和本 PR 更新的架构 Note 里,不另建 bug-fix Note。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/remote-workspace.json:验证步骤写入真实主机验收;两端证据加上desktop/internal/core/remote_acceptance_test.go;整机交互验收没做,两端验证状态保持不变。zsh scripts/platform-feature-matrix/verify-platform-feature-matrix.sh,通过(221 项)。没有改平台实现路径。.artifacts/下生成的矩阵视图。插件归属 / Plugin ownership
develop-lithe第三节的自查命令,结果为空。UI 验证 / UI evidence
N/A:界面和文案都没有变化。workbench 只改了测试内核,让测试不再读本机的 WSL 列表;已有截图的内容和 macOS 上生成的一致。
统一日志系统 / Structured logging
N/A:桌面端没有新增或改动日志事件。Core #169 里
NoShell的日志分类仍是no-shell,不带输出内容。界面文案 / i18n
N/A:没有新增或修改界面文字。WSL 的诊断是 wsl.exe 的原文,属于上游诊断,不翻译。
逻辑归属 / Logic placement
性能与内存 / Performance and memory
N/A:没有新增后台功能、子进程、缓存或轮询。探测保留的标准输出沿用原有的输出上限。
设置 / Settings
N/A:没有改设置。
插件契约 / Plugin contract
N/A:没有改插件契约、能力版本、插件函数协议或宿主方法。
发行包与资源 / Bundle and resources
zsh scripts/desktop/verify/verify-runtime-bundle-immutability.sh,通过。无用代码与重构 / Dead code and refactoring
验证 / Verification
scripts/desktop/desktop-go.sh vet ./internal/core/ ./internal/workbench/(Core 固定为edad041)scripts/desktop/build-remote-server.sh,然后node scripts/desktop/verify/verify-remote-server-artifacts.mjs --stage .artifacts/desktop/remote-server --require-pinnededad041(已固定,工作区干净)LITHE_TEST_REMOTE_SSH_HOST=… LITHE_TEST_REMOTE_SSH_USER=… scripts/desktop/desktop-go.sh test -count=1 -run TestRemote ./internal/core/TestRemoteAcceptanceRunsSurviveALostConnectionAndAKeptClose/ssh用时 0.56s,WSL 那项按预期跳过scripts/desktop/desktop-go.sh test -count=1 -run Remote ./internal/workbench/verify-remote-server-artifacts.mjs --require-pinnedLITHE_TEST_REMOTE_WSL_DISTRO=Ubuntu scripts/desktop/desktop-go.sh test -count=1 -v -run TestRemote ./internal/core/…KeptClose/wsl用时 5.84s,TestRemoteAcceptanceWSLRefusesAnAbsentDistributionAndUser用时 0.23s;修复前(Core18feb4a)没装的发行版报failedscripts/desktop/desktop-go.sh test -count=1 ./internal/remoteconn/ ./internal/remoteserver/ ./internal/remoteplaceholder/scripts/desktop/desktop-go.sh test -count=1 -run Remote ./internal/workbench/gofmt -l desktop/internal/core desktop/internal/workbenchzsh scripts/agent-notes/verify-agent-notes.shzsh scripts/platform-feature-matrix/verify-platform-feature-matrix.shzsh scripts/desktop/verify/verify-runtime-bundle-immutability.shdevelop-lithe第三节)Windows 环境: 用户本人的 Windows 主机,原生 x86_64,没有仿真。测试只在一个临时工作树里运行,测试结束后已终止 WSL 发行版,并删除临时文件和临时工作树。
未能执行的检查和原因:
提交前确认 / Final checks
main(dd58dc0dc,即 feat(desktop): 远程工作区的运行在断线重连后接着输出,关闭时保留的进程可在运行窗口接回 (#2231) #2299 合入后)创建;目标分支main