Repository navigation
fix(desktop): 补传远端临时脚本写入边界并跳过 Windows 根目录替换监听用例 - #2375
Merged
Merged
Conversation
1lck
marked this pull request as ready for review
November 24, 2026 01:59
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
PR 类型 / Type
改动说明 / What changes
背景 / Why
目前
main分支(dc9618a4c)上的Desktop CI(Run45265279585)在三个桌面平台均处于失败状态,导致后续所有合入主干的 PR 都无法通过门禁:desktop/internal/workbench中 6 个TestRemoteWorkspaceRun*用例全部失败,报错lithe core: remote.writeFile: save must carry its workspace boundary (permission_denied)。desktop/internal/pluginservice中的TestWorkspaceWatchUsesNativeEventsAndReleasesOwnedSubscriptions/root-replacement在重命名被监听根目录或等待其 resync 时失败(Run45254949766报rename ...: Access is denied.;Run45265279585报 8 秒context deadline exceeded)。改动 / Changes
desktop/internal/workbench/remote_run.go(writeScript):向h.kernel.RemoteWriteFile显式传入当前运行临时目录start.scratch作为第 6 个root写入边界参数,既满足#2367引入的remoteHostKernel.RemoteWriteFile边界检查,也在启用了Feature::GuardedWrites的远端服务中阻止在临时目录下跟随符号链接。desktop/internal/pluginservice/hostworkspacewatch_test.go(TestWorkspaceWatchUsesNativeEventsAndReleasesOwnedSubscriptions):仅在runtime.GOOS == "windows"时跳过root-replacement子用例并关联跟踪 Issue#2374;dispose、context、session三个资源释放子用例继续在 Windows 运行,macOS 与 Linux 继续完整覆盖root-replacement。shared/platform-feature-matrix/features/remote-workspace.json与shared/platform-feature-matrix/features/plugin-host-editor-file-window-services.json:按实际实现与测试范围同步验证说明,Windows 与 macOS 的verificationStatus仍保持pending。不在本 PR 范围内 / Out of scope
ReadDirectoryChangesW打开根目录句柄导致跨目录重命名拒绝或缺失自身重命名resync的底层改造与真实行为设计:已提交并跟踪于#2374,不在本解除主干阻塞 PR 内绕过生产代码。类型专属:fix
复现与根因
main(dc9618a4c)运行./scripts/desktop/desktop-go.sh test -v -count=1 ./internal/workbench -run '^TestRemoteWorkspaceRun',期望全部通过;实际全部 6 个测试失败并耗时42.994s,前 2 个及第 6 个直接报remote.writeFile: save must carry its workspace boundary (permission_denied),中间 3 个保活恢复用例因准备步骤写入临时脚本失败而未启动进程并在 8 秒后超时。Windows CI 上运行./scripts/desktop/desktop-go.sh test ./internal/pluginservice在root-replacement子用例因ReadDirectoryChangesW持有root打开句柄而失败。bc7d58a81(#2367)在desktop/internal/workbench/remote_documents_test.go的remoteHostKernel.RemoteWriteFile增加必须传入非空且覆盖目标路径的root边界校验并同步更新了remote_documents.go:252,但遗漏了remote_run.go:247写入远端临时运行脚本的调用点(仅传入ctx, start.session.id, script.Path, ..., nil)。实查PINNED_CORE_REVISION(9ab2336e)sessions.rs、guarded_write.rs与server/platform/mod.rs确认远端服务启用了Feature::GuardedWrites,传start.scratch作为root时可规范化临时目录并禁止其下符号链接。5ea2c1c7a(#2369)新增的root-replacement子用例假设在监听打开期间可以把root跨父目录os.Rename且系统会投递resync;而 Windows 上viva/internal/filewatch/watch_windows.go:64对root持有CreateFile目录句柄等待ReadDirectoryChangesW,在 NTFS 上会拒绝或丢失根目录自身的重命名事件。remote_run.go为 macOS / Linux / Windows 共用桌面代码;root-replacement跳过仅作用于 Windows。检查项
desktop/internal/workbench/remote_run_test.go(^TestRemoteWorkspaceRun)在修复前dc9618a4c上 6 个用例全部失败(FAIL ... 42.994s,save must carry its workspace boundary),传入start.scratch后-race(6.343s)与-tags 'dev vivahead'(2.934s)全部通过;hostworkspacewatch_test.go在 GitHub Actions Windows CI(Runs45254949766、45265279585)复现失败,已建#2374并在runtime.GOOS == "windows"仅跳过root-replacement。rg -n 'RemoteWriteFile' desktop/确认生产调用仅remote_documents.go:252(已传r.binding.RemoteRoot())与remote_run.go:247两处,internal/core/remote_session_test.go:164测试CodeConnectionClosed错误路径不受影响。root-replacement已建独立 Issue 跟踪;remote_run.go为跨平台共同路径已一并修复)。.agents/notes/implemented/bug-fix/记录:本修复补齐既有调用边界并在单测中显式跳过未支持平台行为(见#2374),未改变既有架构约束或公共 API 协议。范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/remote-workspace.json与plugin-host-editor-file-window-services.json:补充writeScript边界参数说明与 Windowsroot-replacement跳过说明(#2374);未跑完的整机验收保持pending。./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh(222项能力通过)与./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD(通过)。.artifacts/下生成的矩阵视图。插件归属 / Plugin ownership
develop-lithe第三节“插件归属与宿主零依赖”的自查命令,结果无本次改动引入或新增的 concrete plugin 依赖。hostworkspacewatch_test.go使用合成插件 IDdev.lithe.test.workspace-watch)。shared/i18n/;插件构建与资源说明未写进宿主文档。UI 验证 / UI evidence
N/A:纯桌面远端执行边界参数与
pluginservice测试平台过滤修复,无布局、控件、样式、文案、菜单、弹窗或交互状态变化。统一日志系统 / Structured logging
N/A:未新增或改动日志事件、通道或错误处理边界。
界面文案 / i18n
node scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --check(12628/12628)与node --test --test-timeout=60000 scripts/i18n/test-i18n.mjs(62/62),全部通过。逻辑归属 / Logic placement
guarded_write.rs与sessions.rs执行;桌面端remote_run.go只传递既有start.scratch边界。性能与内存 / Performance and memory
N/A:未新增后台任务、缓存、轮询、依赖,也不影响启动、打开、输入、滚动、大文件或搜索热路径。
设置 / Settings
N/A:未改动设置项、设置页或配置对话框。
插件契约 / Plugin contract
N/A:未修改插件契约、
PINNED_CORE_REVISION(复用主干dc9618a4c固定的9ab2336e8ca651e40baa5e65848b717b26f69e43)或后端协议。发行包与资源 / Bundle and resources
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh通过。无用代码与重构 / Dead code and refactoring
ReadDirectoryChangesW根目录替换限制已提交独立 Issue#2374跟踪,未在本 PR 顺手改动底层或编写绕过代码。验证 / Verification
(cd desktop && gofmt -l .)、git diff --check origin/main...HEAD./scripts/desktop/desktop-go.sh vet ./...、vet -tags dev ./..../scripts/desktop/desktop-go.sh test -v -race -count=1 ./internal/workbench -run '^TestRemoteWorkspaceRun'42.994s);修复后 6 项全部通过(6.343s)./scripts/desktop/desktop-go.sh test -v -tags 'dev vivahead' -count=1 ./internal/workbench -run '^TestRemoteWorkspaceRun'2.934s)./scripts/desktop/desktop-go.sh test -v -race -count=1 ./internal/pluginservice -run '^TestWorkspaceWatch'2.704s)./scripts/desktop/desktop-go.sh test -race -count=1 ./internal/pluginservice55.675s)./.agents/skills/write-stable-tests/scripts/test-stability-macos.sh(TestWorkspaceWatch、TestRemoteWorkspaceRun)与verify-test-stability.sh --base origin/main.artifacts/test-stability/;Rust 扫描 N/A)verify-platform-feature-matrix.sh与verify-platform-feature-matrix-change.sh origin/main HEADverify-agent-notes.sh、verify-runtime-bundle-immutability.sh、validate-pins.mjsbb85256c8ffa/ Core9ab2336e8ca6)verify-app-language-localization.mjs、generate-i18n.mjs --check、test-i18n.mjs、desktop-core-cache.test.mjs12628/12628;62/62;1/1)未能执行的检查和原因:
Desktop CI(Linux / macOS / Windows 全三端)覆盖验证。提交前确认 / Final checks
main(dc9618a4c)创建;目标分支为main.build/、target/、dist/、.artifacts/等产物或个人路径