fix(#1989): don't relock on meta-update cascade rebuilds (was reverting the bump)

This commit is contained in:
damocles 2026-06-25 00:36:52 +02:00
commit 1f0cc010ad
4 changed files with 36 additions and 6 deletions

View file

@ -413,6 +413,7 @@ pub async fn rebuild(
name: &str,
hive: &HiveEnv,
paths: &AgentPaths,
relock: bool,
on_step: &(dyn Fn(&str) + Send + Sync),
on_build_log_id: &(dyn Fn(i64) + Send + Sync),
) -> Result<()> {
@ -426,7 +427,16 @@ pub async fn rebuild(
// Then bump just this agent's input — picks up whatever
// `applied/<n>/main` currently points at (deployed/<latest>).
// Commits the lock if it changed.
crate::meta::lock_update_for_rebuild(name).await?;
//
// `relock = false` skips this: a meta-update cascade has *just* set
// the meta lock deliberately, and `lock_update_for_rebuild` re-runs
// `nix flake update agent-<name>`, which re-resolves the agent's
// transitive inputs back to the agent's own flake.lock — reverting
// the input the meta-update just bumped. Cascade rebuilds therefore
// build against the freshly-set on-disk lock as-is.
if relock {
crate::meta::lock_update_for_rebuild(name).await?;
}
rebuild_no_meta(name, hive, paths, on_step, on_build_log_id).await
}