Skip to content

修复 Windows MinGW 桌面构建链接失败 - #558

Open
mojie126 wants to merge 2 commits into
aimod-cc:betafrom
mojie126:pr/2026-11-10-runtime-build
Open

mojie126 wants to merge 2 commits into
aimod-cc:betafrom
mojie126:pr/2026-11-10-runtime-build

Conversation

@mojie126

Copy link
Copy Markdown

变更

  • 桌面库的 crate-type 从 staticlib、cdylib、rlib 收敛为 rlib。
  • 避免 Windows MinGW 下 cdylib 导出全部符号并触发 export ordinal too large 链接失败。
  • 显式声明 agent2api 二进制目标,使 Cargo 产物名与 Tauri CLI 使用的 mainBinaryName 一致。
  • 保留 MSVC 构建路径不受影响,仓库内没有静态库或动态库消费者。
  • 不携带本机构建脚本与 fork 专属发布流程。

验证

  • 使用 D:\msys64\mingw64\bin 临时加入 PATH 后,cargo check --release:通过。
  • cargo test --release -p agent2api-server --lib:388 通过,0 失败,11 项因缺少插件测试二进制而忽略。
  • git diff --check:通过。

说明

  • 本 PR 基于官方 beta 的 aba58858 重新整理,只修改桌面 Cargo 配置。

🤖 本条回复由 AI Agent 生成

- 桌面库只保留 rlib,避免 cdylib 导出全部符号触发 export ordinal too large
- 显式声明 agent2api 二进制,使 cargo 产物名与 Tauri 打包名一致
- 不携带本机构建脚本与 fork 专属发布流程
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

1. 📌 通俗总结(这个 PR 做了什么?)

这个 PR 处理两个问题。

一是调整桌面端的 Cargo 配置,只生成 rlib,不再生成静态库和动态库。仓库说明桌面端不需要这些库文件;Windows MinGW 下生成 cdylib 还可能因导出符号过多而触发 export ordinal too large。配置也显式声明名为 agent2api 的二进制目标,让 Cargo 产物名称与 Tauri 配置一致。

二是修正就绪闸门的 TTL 测试。测试现在先固定登记时间,再检查过期边界,避免登记后读取真实时钟造成边界判断偶发失败。

2. 💡 产品与技术方案评估

这两项改动分别针对构建配置和测试稳定性,没有改变应用功能或用户操作。

对 MinGW 链接问题,只保留 rlib 是针对触发问题的产物类型进行处理;如果桌面端确实没有静态库或动态库消费者,这比继续生成无用产物更直接。二进制目标名称也得到明确约束,减少 Cargo 与 Tauri 打包名称不一致的风险。当前差异支持这些改动的意图,但不能据此独立确认各平台构建结果。

测试改动固定了登记时刻与 TTL 判定的时间基准,消除了真实时钟读取之间的调度延迟影响。它修复的是测试边界不稳定,不是生产环境中的闸门时钟行为。

本次变更调整 Tauri Cargo manifest:库目标仅生成 rlib,并将 src/main.rs 声明为名为 agent2api 的二进制目标。闸门过期测试改用固定时刻登记闸门,并以该时刻作为 TTL 边界断言的基准。

Changes: Cargo 目标声明

Layer / File(s) Summary
库与二进制目标声明
desktop-tauri/src-tauri/Cargo.toml
库目标的 crate-type 改为仅 rlib。新增名为 agent2api、路径为 src/main.rs 的二进制目标。

闸门过期测试

Layer / File(s) Summary
固定闸门登记时刻
desktop-tauri/src-tauri/server/src/server/core/providers/readiness.rs
测试改用 hold_at 在 base 时刻登记闸门,并在登记前读取 base,作为后续 TTL 边界断言的基准。

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

Possibly related PRs

  • aimod-cc/Agent2API#531:该 PR 也将桌面库的 crate-type 改为仅 rlib,并声明 agent2api 二进制目标。
Merge Risk: Minimal · up to 771bc

No concrete merge-blocking issue was found in the inspected build paths.

Security architecture risk: Low · up to 771bc

The inspected changes do not introduce a reachable security boundary or expand privileges. The main uncertainty is compatibility with external build and publication processes that may consume the removed library outputs or the previous executable name.

Retained concerns
No architecture-level concerns identified.

Security review details

Resilience and Maintainability Implications

  • observed — The gate tests serialize registry access and clear state before each case. The inspected transition logic preserves provider-keyed ownership, the first registration’s expiry deadline, explicit release, and removal at expiry. These production rules are unchanged by the PR.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed 标题准确概括了主要改动:修复 Windows MinGW 桌面构建的链接失败。
Description check Passed 描述说明了 crate-type 和二进制目标的调整,也列出了构建与测试结果,与本次改动相关。
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Clippy (1.99.1)

Clippy execution failed

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 934977de-7090-41ca-aab4-bea7e068c9e5
Commits

Reviewing files that changed from the base of the PR and between a0f19d1 and 771bc41.

Files selected for processing: 1

  • desktop-tauri/src-tauri/server/src/server/core/providers/readiness.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

- 就绪闸门测试以固定登记时刻计算寿命,避免真实时钟读取晚于登记造成边界断言偶发失败
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant