Repository navigation
feat(desktop): 远程工作区的运行在断线重连后接着输出,关闭时保留的进程可在运行窗口接回 (#2231) - #2299
Merged
Merged
Conversation
- 运行中连接断开、主机保留会话时,Run 窗口等待重新连接;接上同一个主机会话后经 remote.attachProcess 从丢失处接着输出,丢了部分输出时说明,可多次断线 - 主机开了新会话、进程已不在、被另一个连接接收时结束运行并说明原因 - 等待期间停止的运行,在接上同一个主机会话后强制结束主机进程 - 关闭时保留的进程,下次连接可“在运行窗口中接回”,每个进程一个带“主机”徽标的标签页 - Core 客户端新增 remote.attachProcess、process.attached 和两个错误码 - 固定 Core main 18feb4a(含 Lithe-IDEA/Lithe-core-rust#167) - 截图、功能矩阵、Agent Note 同步更新
xiaoyumuxi
marked this pull request as ready for review
November 22, 2026 04:38
xiaoyumuxi
added a commit
that referenced
this pull request
Nov 22, 2026
…测试 (#2231) (#2300) #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
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
在这个 PR 之前,远程工作区的运行(#2293)会在和主机的连接断开时直接结束。主机上的进程其实还在跑,但 Run 标签页显示已退出,之后的输出和退出码都看不到。另外,关闭工作区时选“保留”的进程(#2291),下次连接只能列出来或结束,没法再看到它的输出。
Issue #2231 要求:
Core 部分已在 Lithe-IDEA/Lithe-core-rust#167 合入(
18feb4a):remote.attachProcess从这次连接没收到的第一个事件开始转发;process.attached(truncated表示停放的事件超过上限);remote_process_gone、remote_process_attached。本 PR 把桌面端的 Core 固定版本升到
18feb4a,完成 Run 窗口这一侧。改动 / Changes
Core 固定版本
scripts/desktop/build-desktop-core.sh:PINNED_CORE_REVISION从2e4be2c升到 Core main18feb4a(含 fix-issue-159:修复 Mac 端 PR 与 Git 窗口切换卡顿问题 #167)。Core 客户端
desktop/internal/core/errors.go:新增CodeRemoteProcessGone(remote_process_gone)和CodeRemoteProcessAttached(remote_process_attached),与 Core 一一对应。desktop/internal/core/remote_process.go:RemoteAttachProcess(ctx, sessionID, processID, events)。RemoteProcessEvents新增Attached func(truncated bool),处理process.attached。receiveRemoteProcess。断线后接着输出(
desktop/internal/workbench/remote_run.go)remoteRunHost.follow):remote.attachProcess,先写一行“已重新连接,输出继续”,丢了部分输出时再写一行“部分输出已丢失”,然后接着显示之后的输出和退出码。可以多次断线、多次接回。remote_process_gone(进程已不在主机上)或remote_process_attached(另一个窗口已在显示它的输出)时,运行结束并说明原因。process.kill强制结束主机进程(endAbandonedRuns)。closeRemoteRuns),是否结束主机上的程序由关闭确认决定。remoteRunHostOf,运行配置和执行前步骤(runconfig_before_launch.go)都改用它取主机接缝。会话状态(
remote_workspace.go)live),以及等待接回的运行和等待强制结束的进程。attachRemote)时唤醒等待的运行;断线(loseRemote)和关闭时清掉当前会话。保留进程的接回(
remote_close.go)remote-attach:<进程 id>,同键的运行已存在时不再开第二个。Run 窗口随之打开。§7.3 输出里的远端路径
DecodeBuildTestResults),远程工作区在 R3 之前不在主机上运行插件构建,所以这两项的映射随 R3 一起做,由 Core 在解码报告时完成。已写入 Agent Note。文案、矩阵和文档
shared/i18n/features/remote-connections.json:新增 10 条中英文词条(等待重新连接、已重新连接、部分输出已丢失、已换成新的主机会话、主机上已没有这个程序、另一个窗口已在显示、已接回保留的进程、“在运行窗口中接回”按钮、终端无法接回、接回失败);已重新生成desktop/internal/i18n/shared.generated.go。shared/platform-feature-matrix/features/remote-workspace.json:能力、验证步骤和备注加上断线接回和保留进程接回;两端状态和证据不变(改动的文件都已在证据里)。.agents/notes/implemented/architecture/2026-11-22-remote-workspace-process-runs.md:新增“断线后接回(#43c)”“保留进程的接回(#43c,设计 §9.2、S35)”两节,改写“输出里的路径”一节(§7.3 结论),补充被否决的方案、后果和验证。docs/assets/remote-run/、docs/assets/remote-close/:新增断线等待、重连后接着输出、接回保留进程的截图,重新生成受影响的已有截图,README 同步更新。测试
remote_run_test.go:TestRemoteWorkspaceRunFollowsItsProcessAcrossAReconnection:断线后运行仍是运行中,接回后先说明已重新连接、丢了输出时说明已丢失,再显示之后的输出和退出码;可以多次断线。TestRemoteWorkspaceRunEndsWhenItsProcessCannotBeReceivedAgain:主机开了新会话、进程已不在、另一个窗口已在显示三种情况,运行都结束并说明原因。TestRemoteWorkspaceRunStoppedWhileDisconnectedEndsOnceReconnected:等待期间停止的运行,接上同一个主机会话后强制结束主机进程。reconnectWhileRunning:只等重连这一个后台任务,避免等全部后台任务时被还在运行的进程卡住。remote_close_test.go:TestRemoteCloseShowsTheKeptProcessesInTheRunWindow断言保留的进程在重连后的主机会话上接回、各开一个远程标签页并显示“已接回”说明、Run 窗口打开、记下remote.kept.attach动作。重复接回时不开第二个标签页由运行键保证,这个测试没有单独覆盖。remote_run_visual_test.go、remote_close_visual_test.go:新增waiting、resumed、attached场景。不在本 PR 范围内 / Out of scope
截图 / Screenshots
所有截图都由
TestVisualRemoteRun、TestVisualRemoteClose生成,左边浅色英文,右边深色中文。断线后等待重新连接,Run 标签页仍是运行中:
重新连接后接着输出,说明部分输出已丢失:
下次连接时列出保留的进程,多一个“在运行窗口中接回”,并说明终端无法接回:
接回后每个保留的进程在 Run 窗口里各有一个带“主机”徽标的标签页:
类型专属:feat
多平台对齐
platform-specific),理由:范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/remote-workspace.json:改了能力、验证步骤和备注;改动的文件都已在两端证据里;两端的实现状态和验证状态不变,整机验证仍为pending。zsh scripts/platform-feature-matrix/verify-platform-feature-matrix.sh,validated 221 platform capabilities。.artifacts/下生成的矩阵视图。插件归属 / Plugin ownership
develop-lithe第三节的自查命令,结果为空。UI 验证 / UI evidence
TestVisualRemoteRun(新增waiting、resumed)和TestVisualRemoteClose(新增attached,offer多了按钮和终端说明),覆盖浅色英文和深色中文,截图基于本 PR 的提交。docs/assets/remote-run/、docs/assets/remote-close/。统一日志系统 / Structured logging
performed记录remote.kept.attach;operationRejectedremote_attach_programs/disconnected;backgroundFailed,等待期间停止、重连后强制结束失败记run_stop_after_reconnect和 Core 错误码。// log-exempt:。界面文案 / i18n
shared/i18n/features/remote-connections.json中补齐中英文,并已重新生成desktop/internal/i18n/shared.generated.go。node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,都通过。逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
N/A:没有改设置页或设置项。
插件契约 / Plugin contract
N/A:没有改插件契约、能力版本、插件函数协议或宿主方法。
remote.attachProcess是 Core 远程命令,不是插件宿主方法。发行包与资源 / Bundle and resources
zsh scripts/desktop/verify/verify-runtime-bundle-immutability.sh,通过。无用代码与重构 / Dead code and refactoring
验证 / Verification
scripts/desktop/desktop-go.sh vet ./internal/workbench/ ./internal/core/scripts/desktop/desktop-go.sh test -count=1 ./internal/workbench/ ./internal/core/18feb4a后:scripts/desktop/desktop-go.sh test -count=1 -run 'TestRemote' ./internal/workbench/ ./internal/core/LITHE_VISUAL_OUTPUT_DIR=… scripts/desktop/desktop-go.sh test -count=1 -tags vivahead,lithevisual -run 'TestVisualRemoteRun|TestVisualRemoteClose' ./internal/workbench/gofmt -l desktop/internal/zsh scripts/agent-notes/verify-agent-notes.shzsh scripts/platform-feature-matrix/verify-platform-feature-matrix.shnode scripts/i18n/generate-i18n.mjs --check、node scripts/i18n/verify-app-language-localization.mjszsh scripts/desktop/verify/verify-runtime-bundle-immutability.shdevelop-lithe第三节)未能执行的检查和原因:
提交前确认 / Final checks
main(5d426b9d5)创建;目标分支mainbuild.example等占位主机