Merge pull request '修复 AGC dev 无限重建:Codex 组件权限仅在真正不一致时写入' (#487) from fix/agc-dev-codex-rebuild-loop into master
Project CI / AI game creator shell Rust smoke (push) Successful in 1m19s
Project CI / AI game creator shell Rust crates (push) Successful in 1m5s
Project CI / Backend tests (push) Successful in 3m42s
Project CI / AI game creator shell Rust lane 2/2 (push) Successful in 8m2s
Project CI / Frontend tests (push) Successful in 2m14s
Project CI / AI game creator shell Rust lane 1/2 (push) Successful in 8m56s
Project CI / Native shell tests (push) Successful in 6m21s
Project CI / AI game creator shell web tests (push) Successful in 2m37s
Project CI / Repository checks (push) Successful in 3m23s

Reviewed-on: #487
This commit was merged in pull request #487.
This commit is contained in:
2026-09-23 11:13:02 +08:00
+15 -8
View File
@@ -125,17 +125,24 @@ fn stage_codex_target(manifest_dir: &std::path::Path, target: &str) {
&& sha256_file(&target_path)
.map(|target_sha256| target_sha256 == source_sha256)
.unwrap_or(false);
let source_permissions = fs::metadata(&source_path)
.expect("读取组件权限失败")
.permissions();
if !target_matches_source {
fs::copy(&source_path, &target_path).expect("复制内置 Codex CLI 资源失败");
fs::set_permissions(&target_path, source_permissions.clone())
.expect("保留内置 Codex CLI 组件权限失败");
} else if fs::metadata(&target_path)
.expect("读取内置 Codex CLI 资源失败")
.permissions()
!= source_permissions
{
// 内容相同但曾被错误 chmod 的 staging 文件也必须恢复执行权限。
// 权限已一致时不再写元数据:Windows 上这次写入会更新 change time
// 让 tauri dev 的文件监听把每次构建都当成 staging 变更而无限重建。
fs::set_permissions(&target_path, source_permissions)
.expect("保留内置 Codex CLI 组件权限失败");
}
// 内容相同但曾被错误 chmod 的 staging 文件也必须恢复执行权限。
fs::set_permissions(
&target_path,
fs::metadata(&source_path)
.expect("读取组件权限失败")
.permissions(),
)
.expect("保留内置 Codex CLI 组件权限失败");
file_hashes.insert(
relative.to_string(),
serde_json::Value::String(source_sha256),