Repository navigation
feat(remote): 编译 Linux 远端服务并在 CI 校验产物 - #2240
Merged
Merged
Conversation
#2231 R0 第一步: - 新增 scripts/desktop/build-remote-server.sh:在固定的 Core 检出上只开 server 特性, 用 rust-lld 和 --locked 编译 x86_64/aarch64 musl 的 lithe-remote-server, 暂存到 .artifacts/desktop/remote-server/ 并写出带体积和 SHA-256 的清单。 - 新增 scripts/desktop/verify/verify-remote-server-artifacts.mjs 及测试:检查清单、哈希、 ELF 架构与静态链接,能运行时跑 --identity、--version 和 server.hello 冒烟; 体积只报告不设上限(D9)。 - Desktop CI 新增 remote-server 任务(Draft 也运行),x86_64 原生、aarch64 经 qemu-user 冒烟,产物上传 14 天;gate 纳入这一车道。 - build-desktop-core.sh 新增 --checkout-only,只准备 Core 检出,MSVC 主机也可用。 - Agent Note、功能矩阵改为体积不设硬上限;docs/ci-builds.md 记录新构建状态的归属与复制前提。
1 task done
ubuntu-latest 已是 Ubuntu 26.04,qemu-user-static 在那里只是虚拟包, remote-server 任务第一次运行就在安装 qemu 时失败。模拟器上通过也不能说明 产物在真实 arm64 硬件上可用,所以不再用 qemu: - remote-server 只强制 x86_64 的冒烟,去掉安装 qemu 的步骤。 - 新增 remote-server-arm64:在 ubuntu-24.04-arm 上下载同一份产物,恢复可执行位后 重新校验清单和哈希,并原生运行 aarch64 的 --identity、--version 和 server.hello; gate 纳入这一车道。 - verify-remote-server-artifacts.mjs 只在同架构的 Linux 上运行冒烟,不再查找 qemu-<arch>;--require-smoke 改为 --require-smoke <目标>|all,可重复,未知目标以 2 退出。 - 测试、docs/ci-builds.md 和功能矩阵验证说明同步更新。
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
远程工作区(#2231)要把 Core 的
lithe-remote-server上传到 Linux 主机运行。现在仓库里没有编译它的脚本,CI 也不检查它是不是真的静态链接、架构对不对、能不能跑起来。本 PR 先把服务的编译和 CI 校验做好,后续的连接实现直接用这里产出、校验过的文件。同时按 #2231 的 D9(安全 > 功能齐全 > 体积尽量小)去掉两篇 Agent Note 和功能矩阵里“每个服务不超过 1.5 MiB、超过就失败”的规定:体积只报告,不设上限。
改动 / Changes
构建:
scripts/desktop/build-remote-server.sh(新增)build-desktop-core.sh准备的同一份 Core 检出(固定提交,或LITHE_CORE_RUST_DIR)和同一个 Cargo 编译目录。lithe-remote的server特性(--no-default-features --features server),用 Core 的 release profile 和--locked编译x86_64-unknown-linux-musl、aarch64-unknown-linux-musl。rust-lld链接,macOS、Linux、Windows 主机都不需要 Docker、zig 或交叉 C 工具链;缺少目标标准库时提示rustup target add …并退出。cargo clean --workspace,只重编工作区成员。.artifacts/desktop/remote-server/,放入<目标>/lithe-remote-server(0755)和remote-server-manifest.json(schemaVersion、Core 提交、coreWorktreeclean/dirty、coreSourcepinned/override、服务版本、rustc、profile,以及每个文件的路径、体积和 SHA-256)。写入清单的值先按格式校验,防止拼出非法 JSON。校验:
scripts/desktop/verify/verify-remote-server-artifacts.mjs(新增)<目标>/lithe-remote-server(防止路径穿越)、没有重复项。ET_EXEC/ET_DYN、架构正确(62 / 183)、入口非零、没有PT_INTERP、没有DT_NEEDED。--identity的 SHA-256 和版本要与清单一致;--version;--stdio完成一次server.hello:跳过前导噪声(最多 64 KiB),检查协议版本、服务版本、host.os、host.arch和session.persistent=false;关闭 stdin 后服务必须以 0 退出。--require-smoke <目标>|all要求该目标(或全部目标)的冒烟在本机跑通,可重复,未知目标以 2 退出;--require-pinned要求清单来自干净的固定提交检出。GITHUB_STEP_SUMMARY。verify-remote-server-artifacts.test.mjs(13 项):CI:
.github/workflows/desktop-ci.ymlremote-server(Remote server artifacts)任务,跑在ubuntu-latest,限时 20 分钟。Draft PR 也运行,不占用 macOS 和 Windows runner。.artifacts/desktop/lithe-core-rust;缓存键包含 runner、rustc 和两个构建脚本(也就含PINNED_CORE_REVISION)的哈希。--require-smoke x86_64-unknown-linux-musl --require-pinned:两个文件都做清单、哈希、ELF 和静态链接检查,x86_64 在 runner 上原生冒烟。产物以remote-server-linux-musl上传,保留 14 天。remote-server-arm64(Remote server on arm64)任务,跑在ubuntu-24.04-arm(公开仓库免费的标准 arm64 runner),needs: remote-server,限时 10 分钟:下载同一份产物(不重新编译),因为 artifact 不保留文件权限,先chmod 0755恢复可执行位,再运行--require-smoke aarch64-unknown-linux-musl --require-pinned,重新校验清单和哈希后原生运行 aarch64 冒烟。qemu-user-static跑 aarch64,ubuntu-latest已是 Ubuntu 26.04,那里qemu-user-static只是虚拟包,第一次 CI 就在安装步骤失败;而且模拟器上通过也不等于真机可用。Desktop CI gate的needs加入remote-server和remote-server-arm64;scripts/ci/desktop-ci/verify-ci-gate.mjs和它的测试同步加上这两个车道,Draft 也不允许跳过它们。linux任务对新脚本跑bash -n和 ShellCheck,“Run script tests”加入新测试。scripts/desktop/build-desktop-core.sh--checkout-only:只准备 Core 检出,打印检出路径后退出,不编译也不暂存。*-windows-msvc主机上也不再拒绝运行,Windows 开发机可以用它构建远端服务。不带这个参数时,MSVC 主机的拒绝逻辑保持不变。文档与规则
.agents/notes/implemented/architecture/2026-10-24-remote-workspace-routing.md、.agents/notes/proposed/architecture/2026-10-24-remote-development-workspace-host.md:去掉 1.5 MiB 上限;体积只由 CI 报告;记下不能为体积牺牲的项;验收条目改成静态链接、哈希和冒烟;被否方案里加上“固定体积上限”。shared/platform-feature-matrix/features/remote-development-workspace.json:只改验证说明,指向新的构建和校验脚本,体积不设上限;两端状态仍是missing。docs/ci-builds.md:表格里加remote-server和remote-server-arm64任务,gate 说明里加远端服务车道;“独立工作树的本地编译”补上.artifacts/desktop/的写入方(顺手补上漏写的build-viva-tool.sh),新增一段说明暂存目录的路径、归属、生命周期,以及复制到另一个工作树的前提(Core 提交、目标、Rust 工具链相同,复制后跑一次校验确认清单哈希)。本机编译出的体积(Core
4ef9d9e,rustc 1.100.0,只做记录,不设上限)x86_64-unknown-linux-muslaarch64-unknown-linux-musl不在本 PR 范围内 / Out of scope
#2231 §3.2 里还没做的部分,留给后续连接实现:
desktop-release.yml和desktop-autobuild.yml把这两个文件放进安装包,打包后再校验一次(打包目标清单放scripts/ci/common/);verify-runtime-bundle-immutability.sh覆盖连接和上传流程。R0 的其余部分:
功能矩阵
remote-development-workspace的验证说明整段仍然描述旧 Swift 客户端,里面还引用了已经不存在的scripts/remote/verify-remote-workspace.sh。这一段要等 Viva 的远程实现落地后整体改写,已记进 #2231 的“落地时需要一并完成”,本 PR 只改远端服务这一句。类型专属:feat
多平台对齐
范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/remote-development-workspace.json:只改验证说明,指向新脚本,体积改为不设上限;两端仍是missing/not-applicable,因为还没有用户可用的入口./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第三节的自查命令,结果为空UI 验证 / UI evidence
N/A:没有界面改动,只有构建脚本、校验脚本和 CI。
统一日志系统 / Structured logging
N/A:没有改动运行时代码,只有构建和 CI 脚本,脚本输出沿用仓库其他脚本的写法(英文、stderr)。
界面文案 / i18n
N/A:没有用户可见的文字。仍然运行了
node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,都通过。逻辑归属 / Logic placement
lithe-remote。本仓库只编译和校验它,不新增业务逻辑。校验脚本是构建工具,只读取 Core 的公开命令行和协议。性能与内存 / Performance and memory
N/A:没有改运行时代码,没有新增运行时依赖。CI 多了两个 Linux 任务:x86 上编译并校验(本机冷编译两个目标共约 26.5 秒,缓存命中时不到 1 秒),arm64 上只下载产物和冒烟,不编译。
设置 / Settings
N/A:没有设置项。
插件契约 / Plugin contract
N/A:没有改契约或宿主方法,
PINNED_CORE_REVISION不变。发行包与资源 / Bundle and resources
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh,通过。docs/ci-builds.md“独立工作树的本地编译”写清.artifacts/desktop/remote-server/的路径、归属、生命周期和跨工作树复制的前提无用代码与重构 / Dead code and refactoring
验证 / Verification
./scripts/desktop/build-remote-server.shnode scripts/desktop/verify/verify-remote-server-artifacts.mjs --require-pinnedremote-server-arm64的路径:同一产物复制后去掉可执行位,运行--require-smoke aarch64-unknown-linux-musl --require-pinnedchmod这一步必须有chmod 0755之后再运行passed (native, protocol 1),x86_64 报告跳过--require-smoke allnode scripts/desktop/verify/verify-remote-server-artifacts.mjs --require-smoke bogusnode --test scripts/ci/desktop-ci/verify-ci-gate.test.mjs scripts/desktop/verify/verify-remote-server-artifacts.test.mjsbash -n、shellcheck(两个构建脚本)actionlint.agents/skills/write-stable-tests/scripts/verify-test-stability.sh(工作区,以及--base origin/main)./scripts/agent-notes/verify-agent-notes.sh./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh、verify-platform-feature-matrix-change.sh origin/main HEAD./scripts/desktop/verify/verify-runtime-bundle-immutability.shnode scripts/desktop/validate-pins.mjsnode scripts/i18n/verify-app-language-localization.mjs、node scripts/i18n/generate-i18n.mjs --checkdevelop-lithe第三节)未能执行的检查和原因:
build-remote-server.sh,所以--checkout-only在 MSVC 主机上的放行只做了代码审查,没有实测。remote-server任务为准。提交前确认 / Final checks
main创建;目标分支main.artifacts/等产物,没有凭据、个人路径或未脱敏的日志lithe-remote-server进程残留