Skip to content

Windows 构建被 cfg(unix) 门控常量挡住,且 CI 缺 Windows Rust 检查 #803

Description

@coder-hhx

现象

打 tag v1.3.5 后,Desktop ReleaseWindows x64 job 在 Build Windows bundles 步骤失败:

error[E0425]: cannot find value `PID_START_TIME_TOLERANCE_MS` in this scope
   --> crates\agent-gui\src-tauri\src\runtime\process.rs:246:56

Linux / macOS 构建全部成功。

根因

#801 新增的 PID_START_TIME_TOLERANCE_MS 被写成了 #[cfg(unix)],但使用它的
terminate_process_tree_by_pid_if_same 是跨平台函数(Windows 侧也要靠它防 pid 复用
误杀)。macOS / Linux 上这个常量就在作用域里,所以本地检查和 CI 都发现不了。

为什么 CI 没拦住

Tauri Rust Check 只跑 Linux,而且只跑过滤后的部分测试(chat_history /
ssh_local_forward / shell_runner / integration_commands::mcp)。仓库里没有任何
Windows 目标的 Rust 检查,所以这类 cfg 遗漏只能在发布时才暴露——PR 阶段全绿,
代价是一次完整的失败发版(含 macOS 签名/公证)。

修复

常量改为所有平台可见,并加注释说明不能在 unix 下单独定义(PR 见下方关联)。

建议的后续加固(本 issue 不覆盖)

ci.yml 增加一个 Windows 目标检查,把这类问题提前到 PR 阶段,例如:

  • windows-latest 上跑 cargo check --lib(原生目标,最贴近发布构建);
  • 或在 Linux runner 上加 cargo check --target x86_64-pc-windows-msvc
    注意后者只做类型检查、无需链接,能抓住 cfg 遗漏;但本机 gh 凭据缺 workflow
    scope,无法推送 workflow 文件改动,需要由具备该 scope 的人来加。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions