修复 AGC dev 无限重建:Codex 组件权限仅在真正不一致时写入 #487
Reference in New Issue
Block a user
Delete Branch "fix/agc-dev-codex-rebuild-loop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
现象
tauri dev下反复出现:每次构建完成立即又被判定为文件变更,形成"构建 -> 监听 -> 再构建"的无限重建。
根因
apps/ai-game-creator-shell/src-tauri/build.rs的 Codex staging 在内容一致、没有发生 copy 的情况下,仍然无条件执行fs::set_permissions。Windows 上这次写入会更新 NTFS change time(即使权限值不变),而 tauri dev 递归监听src-tauri(resources/plugins/已被.taurignore覆盖,resources/codex/未覆盖),于是每次构建都被当成 staging 变更。直接跑构建脚本 +
fs.watch探针实测(修复前):mtime/size 完全不变、只有 ctime 变化,说明是元数据写入而非内容变更;staged 文件与源包权限本来就一致(644 vs 644),所以手工修正文件权限无法解决,必须让构建脚本不再写这次元数据。
修改
只改
build.rs:source_permissions后,仅在!target_matches_source(需要复制)或目标权限与源权限不一致时才调用set_permissions。验证
resources/codex/win-x64/**0 个事件,全部文件 mtime/ctime/size 不变。Rebuilding application;touch src-tauri/src/main.rs只触发一次重建(监听未被误伤),随后 app 进程 PID 稳定 90s 以上。npm run check:rustfmt、npm run check:encoding(5097 文件)、cargo check -p api-server --manifest-path server-rs/Cargo.toml均通过。影响范围
仅 dev 构建期的 staging 行为;不改变 bundle resources 映射、运行期逻辑与产物内容。回滚即还原
build.rs这一处判断。切换到ReFS之后出现的问题🤔