Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Branch Name
main
Commit ID
Other Environment Information
- Hardware parameters: x86_64 CPU build; native build jobs=2.
- OS type: Linux 6.18.44; GCC 13.3; Go 1.27.1; CMake 4.4.4; Ninja 1.13.0.
- CPU/default release build, no GPU and no tracked source modifications.
Actual Behavior
A clean checkout cannot complete its first native build. Native libraries compile successfully, then the provenance record step fails:
native inputs changed while the build was running
make: *** [Makefile:367: cgo] Error 1
Reproduced in TWO initially clean checkouts at the same SHA:
make -j4 build NATIVE_BUILD_JOBS=2: exit 2 after native compilation.- Independent detached clean worktree,
make -j4 cgo NATIVE_BUILD_JOBS=2: exit 2 with the same diagnostic (80.273s).
Before/after SHA256 comparisons of every tracked file found NO changed tracked files. The second build's final git status is:
?? thirdparties/_croaring_build/
?? thirdparties/_fp16/
?? thirdparties/_jemalloc_build/
?? thirdparties/_simsimd/
?? thirdparties/_stringzilla/
?? thirdparties/_usearch_build/
These are generated extraction/build trees from the official third-party make rules, not user edits.
Expected Behavior
A standard first build from an initially clean checkout should complete. Generated third-party work directories should not invalidate native input provenance; genuine source/input changes must still be detected.
Steps to Reproduce
- Check out the above commit in a fresh directory; verify
git status --porcelainis empty. - Install the toolchain and native build prerequisites.
- Run
make -j4 cgo NATIVE_BUILD_JOBS=2(also reproduced viamake -j4 build NATIVE_BUILD_JOBS=2). - Observe native compilation succeed followed by the provenance error and exit 2.
- Run
git status --porcelain --untracked-files=all -- thirdparties; observe generated extraction directories. Check tracked-file hashes: unchanged.
The independent second checkout reused only byte-verified downloaded archives to avoid repeat downloads; it had no prebuilt libraries or build trees and was clean before invocation.
Additional information
Cause: cgo/mo-native-provenance prepare uses git status --porcelain --untracked-files=all -- $native_paths to mark an initially clean build reusable (around lines 426–435). Record repeats that check (around lines 661–668). The standard native build creates the unignored directories above under those native paths, making native_status nonempty and triggering the fatal check even though tracked native input hashes did not change.
Controlled confirmation: moved ONLY these untracked generated trees recoverably outside the first checkout, without editing source, .gitignore, stamps, or the guard. The unchanged official provenance record command then succeeded; the official build-with-prebuilt-native completed. This staging workaround is not needed for already-dirty builds but demonstrates the clean-to-generated-dirty mismatch. Do not weaken detection of real modified native inputs.
This is a build-system bug, separate from database restart/recovery candidates. No database storage was opened by the native-build reproduction. Complete logs and tracked-file SHA manifests are retained.
Activity
XuPeng-SH commentedon Oct 14, 2026
Reproduced again on current main
678b72b9292cd5e9e26c90b469e575322bb0f617(2026-10-15, Asia/Shanghai), using an initially clean shallow checkout, Go 1.27.1, and native jobs=2.make -j2 build NATIVE_BUILD_JOBS=2 BRANCH_NAME=main LAST_COMMIT_ID=678b72b9292cd5e9e26c90b469e575322bb0f617 MO_VERSION=maincompiled the native libraries, then exited 2 with:All 11,200 tracked-file SHA256 hashes remained unchanged.
git status --porcelain --untracked-files=all -- Makefile cgo thirdpartieslisted 1,010 generated native-tree entries, includingthirdparties/_fp16/.Without editing production sources, moving generated trees, changing ignore rules, or altering provenance stamps, the official
build-with-prebuilt-nativetarget then built the executable successfully from the native libraries just produced by this run. The resulting binary SHA256 is3dcde31b4409ad6adcfde3e722b177c142d41191de13991881934dc1710ebf44. The initial failure, generated-path list, source hash manifest, and both build logs are retained. This remains a native-build provenance problem; it is separate from the database restart candidates.fix(build): ignore thirdparties scratch trees in native provenance ch…
fix(build): ignore thirdparties scratch trees in native provenance ch…
daviszhen commentedon Oct 20, 2026
最新 main 验证(2026-10-20)
基线:
309f618995af4ee23e3b9149365f4af77264090d;关联修复 PR:#30592。结论:原问题已解决。宿主机
optools/TestNativeBuildScratchDirsStayIgnored通过,exact-main Docker native build 也成功;生成的 thirdparty scratch 目录不再被误判为 native build 输入。issue 页面仍为 OPEN,建议转测试或关闭。
Ariznawlll commentedon Oct 20, 2026
测试版本
main3829ee49c7c118f2f3b0ebf7ed3acbd52483d870(启动本轮验证时的官方 main;随后 main 前进,本评论不声称测试后续 SHA)c33b29529c20694811427bbcee10d40ba8e96081已包含在本次测试 SHAgit status --porcelain为空的 3 个独立 worktree;macOS arm64、Go 1.27.1、系统 clang、CPU/release native build,NATIVE_BUILD_JOBS=2。使用已按仓库 SHA256 校验的 ONNX 本地预编译依赖,未改源码、ignore 规则或 provenance 脚本;未启动数据库原问题验证
在三个全新且相互独立的 clean worktree,分别执行
make -j4 cgo NATIVE_BUILD_JOBS=2,三轮均退出码 0(3/3)。各轮生成cgo/libmo.dylib、thirdparties/install/lib/onnxruntime_arm64.dylib和cgo/.mo-native-provenance;git status --porcelain --untracked-files=all -- Makefile cgo thirdparties均为空。没有再出现原报告中的native inputs changed while the build was running。随后对其中一个 worktree 再执行两次同命令,均退出码 0,验证已生成产物的重用路径。另一个 clean worktree 的首次 native 构建曾在下载 ONNX 依赖时遭遇 GitHub 网络超时;该次在产品 provenance 阶段之前由我中断。依赖可达后同一源码未修改地重试,构建成功。此网络事件不是产品失败,也没有计入上述 3/3 clean 成功次数。
Happy Path 覆盖
make -j4 cgo NATIVE_BUILD_JOBS=2均成功写出 provenance stamp 与 native 库;全部 tracked native 输入保持 clean。thirdparties/_fp16/放置生成型测试文件:git check-ignore -v指向.gitignore的_fp16规则;native 范围git status为空,mo-native-provenance prepare返回reuse。测试文件随后删除。Unhappy Path 覆盖
thirdparties/根目录放置非生成型未跟踪输入:git status显示该文件,mo-native-provenance prepare的 pending 记录reusable=no,证明修复没有把真正的 native 输入变化错误放行。删除测试文件后重新prepare,pending 记录恢复为reusable=yes,工作树仍 clean。白盒验证
现有回归
optools/TestNativeBuildScratchDirsStayIgnored在本次官方 main 上-count=3通过;设置可用系统 locale 后go test ./optools -count=3整包通过(343.022s)。首次整包尝试因宿主机继承了不存在的C.UTF-8locale,子命令输出额外 warning 干扰严格输出比较而失败;修正测试进程 locale 后通过,属于测试环境噪声,不是本 issue 产品失败。回归测试
修复 PR #30592 已加入
optools/TestNativeBuildScratchDirsStayIgnored,与原 native provenance 路径同仓库。该问题发生在数据库服务构建前,MOTR SQL/协议层无法触发,故未向 MOTR #247 添加重复用例。PR 的 Ubuntu/x86 UT Coverage 成功;同 PR 的 TKE Docker 构建 在拉取golang:1.27.1-bookworm镜像元数据时 Docker Hub 连接超时,未运行产品测试;本次未触发昂贵 CI。Linux/x86 全新 native build 未由本轮独立复测,不将 macOS 结果冒称 Linux 结果。测试证据
libmo和 clean 状态均已逐项检查;构建产物可在本地隔离测试目录/var/folders/rn/cv4hr4dn64b8712phbc7rkxw0000gn/T/mo-native-30235-{b,c,d}-*/repo对照。主工作目录未改动。测试结论
测试通过。