Repository navigation
fix(desktop): defer native settings file pickers via c.After - #2412
Merged
Merged
Conversation
xiaoyumuxi
marked this pull request as ready for review
November 25, 2026 08:22
9 tasks done
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
lithe-logs-2026-11-25-145855.zip中发现并修复的运行时 Panic;与Lithe-core-rust的 Windows SSH-E共享冲突修复配套)PR 类型 / Type
改动说明 / What changes
背景 / Why
在 Windows 上打开「设置 → 远程开发(Remote Workspace)」点击「选择…」挑选自定义 SSH 程序时,日志记录了被 Viva 恢复的窗口过程 Panic:
调用栈指向
settingswindow.(*window).remoteSSHConfigRow(remote_workspace_view.go:133)。原因是点击按钮后在页面构建函数执行中途直接同步调用了原生文件对话框app.OpenFiles(...),Windows 模态对话框消息循环重入窗口过程触发了新的一帧并提前结束当前 Frame,返回后继续构建后续行即触发 Panic。同包内其他所有原生文件/目录选择器均已使用c.After(...)延后到绘制结束后执行,排查发现还有两处同类漏写(trusted_locations_view.go与toolchains_view.go),本 PR 一并修复。改动 / Changes
desktop/internal/settingswindow/remote_workspace_view.go:w.pickRemoteProgram(language, r)包裹在c.After(...)中延后到本帧布局结束后执行。pickRemoteProgram开头增加defer w.inv.Invalidate(),确保对话框返回修改草稿后触发重绘。openRemoteProgramFiles = app.OpenFiles供回归测试注入。desktop/internal/settingswindow/trusted_locations_view.go:w.pickTrustedLocation(language)包裹在c.After(...)中,并在pickTrustedLocation增加defer w.inv.Invalidate()。desktop/internal/settingswindow/toolchains_view.go与desktop/internal/settingswindow/toolchains_state.go:w.pickToolchainDirectory(tool.ID, input, directory)包裹在c.After(...)中,并在pickToolchainDirectory增加defer w.inv.Invalidate()。desktop/internal/settingswindow/remote_workspace_view_test.go:TestRemoteProgramPickerRunsAfterPaint,在文件选择回调中调用d.pump()模拟 Windows 模态对话框重入窗口过程,验证不再触发 Panic 且草稿正确更新。不在本 PR 范围内 / Out of scope
-E日志文件共享冲突修复在Lithe-core-rust的独立 PR(fix(remote): avoid holding write handle on SSH evidence log on Windows Lithe-IDEA/Lithe-core-rust#200)中处理;合入后再另行升级scripts/desktop/build-desktop-core.sh的PINNED_CORE_REVISION。类型专属:fix
复现与根因
remoteSSHConfigRow触发app.runtime.panic_interrupted;期望对话框在帧布局结束后打开、关闭后正常回显所选路径且不触发 Panic。remote_workspace_view.go、trusted_locations_view.go、toolchains_view.go在ui.Button(...).Clicked()分支直接同步调用app.OpenFiles/app.OpenDirectory,未按同包其他选择器(如plugin_settings_view.go:288、keymap_import_view.go:97)使用c.After(...)。检查项
desktop/internal/settingswindow/remote_workspace_view_test.go(TestRemoteProgramPickerRunsAfterPaint),通过回调内重入d.pump()覆盖模态重入场景,修复后通过(60 ms)。TestRemoteProgramPickerRunsAfterPaint自动化覆盖;Windows 真机原生对话框交互见下方未执行项说明。desktop/internal/settingswindow内全部app.OpenFiles/app.OpenDirectory调用方。trusted_locations_view.go与toolchains_view.go两处同类调用。.agents/notes/implemented/bug-fix/记录:不改变既有架构/行为约束,沿用既有c.After(...)规范。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/remote-workspace.json:为 Windows 补齐desktop/internal/settingswindow/remote_workspace_view_test.go证据路径(原验证状态pending不变)。./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD。.artifacts/下生成的矩阵视图。插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果为空。shared/i18n/、docs/ci-builds.md、Agent Note 或 Skill。UI 验证 / UI evidence
N/A:不改变布局、控件、样式、文案、菜单、弹窗或可见交互外观,仅将原生文件选择器调用时机移至
c.After(...)。统一日志系统 / Structured logging
N/A:未新增或改动日志事件、日志调用或失败路径。
界面文案 / i18n
N/A:未新增或修改任何用户可见文案。
逻辑归属 / Logic placement
N/A:仅调整 Viva 视图层对原生文件选择器的调度时机,无业务逻辑变更。
性能与内存 / Performance and memory
N/A:无新增后台任务、子进程、缓存、定时器或热路径改动。
设置 / Settings
defer w.inv.Invalidate()刷新草稿显示。插件契约 / Plugin contract
N/A:未修改插件契约或宿主方法。
发行包与资源 / Bundle and resources
N/A:未新增或修改运行时资源、缓存或构建步骤。
无用代码与重构 / Dead code and refactoring
验证 / Verification
./.agents/skills/write-stable-tests/scripts/test-stability-macos.sh --package ./internal/settingswindow -- --filter TestRemoteProgramPickerRunsAfterPaint./scripts/desktop/desktop-go.sh test -race ./internal/settingswindowgofmt -l desktop/internal/settingswindow/..../scripts/platform-feature-matrix/verify-platform-feature-matrix.sh未能执行的检查和原因:
prlctl list -a无 Windows 虚拟机,需在 Windows 机器或 Windows CI 中复验。提交前确认 / Final checks
origin/main创建;目标分支为main.artifacts/等构建产物,没有凭据或个人路径