hive-c0re: push Rebuilt as a todo, not a broker message

This commit is contained in:
damocles 2026-08-02 23:48:25 +02:00 committed by mara
commit c41d2d201d
2 changed files with 31 additions and 21 deletions

View file

@ -109,7 +109,7 @@ pub(super) async fn run_node(
outcome,
} => run_resolve_approval(coord, coord.job_queue.dag_of(id), *approval_id, *outcome).await,
NodeKind::EmitRebuilt { ok, .. } => {
run_emit_rebuilt(coord, agent, coord.job_queue.dag_of(id), *ok);
run_emit_rebuilt(coord, agent, coord.job_queue.dag_of(id), *ok).await;
Ok(())
}
NodeKind::SetWanted { up, .. } => run_set_wanted(coord, agent, *up),
@ -144,19 +144,23 @@ async fn run_resolve_approval(
Ok(())
}
/// Emit this agent's `Rebuilt` manager event. `ok` is not computed — it is which
/// Emit this agent's rebuild-complete todo. `ok` is not computed — it is which
/// of the tail pair the graph let run. The failure note comes from the DAG's
/// first failing node, since the branch knows *that* it failed but not *why*.
fn run_emit_rebuilt(coord: &Arc<Coordinator>, agent: &str, dag_id: Option<u64>, ok: bool) {
coord.notify_manager(&hive_sh4re::HelperEvent::Rebuilt {
agent: agent.to_owned(),
ok,
note: (!ok)
.then(|| dag_id.and_then(|dag| coord.job_queue.first_error(dag)))
.flatten(),
sha: None,
tag: None,
});
async fn run_emit_rebuilt(coord: &Arc<Coordinator>, agent: &str, dag_id: Option<u64>, ok: bool) {
let note = (!ok)
.then(|| dag_id.and_then(|dag| coord.job_queue.first_error(dag)))
.flatten();
let summary = crate::coordinator::rebuilt_todo_summary(agent, ok, note.as_deref(), None, None);
coord
.push_todo(
hive_sh4re::MANAGER_AGENT,
"core",
Some(format!("rebuilt:{agent}")),
summary,
None,
)
.await;
}
/// Write the agent's durable power intent — the DAG-node form of the old