fix(948): topo-sort cascade agents in meta_update_cascade_agents

This commit is contained in:
damocles 2026-06-01 16:50:41 +02:00
commit e8b24e7021

View file

@ -648,7 +648,7 @@ pub async fn meta_update_cascade_agents(inputs: &[String]) -> Vec<String> {
.filter_map(|i| i.strip_prefix("agent-")) .filter_map(|i| i.strip_prefix("agent-"))
.map(|rest| rest.split('/').next().unwrap_or(rest).to_owned()) .map(|rest| rest.split('/').next().unwrap_or(rest).to_owned())
.collect(); .collect();
if touched_hyperhive || inputs.is_empty() { let mut names = if touched_hyperhive || inputs.is_empty() {
crate::lifecycle::list() crate::lifecycle::list()
.await .await
.unwrap_or_default() .unwrap_or_default()
@ -664,7 +664,12 @@ pub async fn meta_update_cascade_agents(inputs: &[String]) -> Vec<String> {
.collect() .collect()
} else { } else {
touched_agents touched_agents
} };
// Sort parents before children so the sequential queue worker
// always rebuilds a parent before any of its dependents.
let topo = crate::topology::read();
crate::auto_update::topology_sort(&mut names, &topo);
names
} }
/// Current unix timestamp in seconds. `now()` calls are pulled into a /// Current unix timestamp in seconds. `now()` calls are pulled into a
@ -1164,3 +1169,4 @@ mod tests {
); );
} }
} }