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

@ -777,16 +777,22 @@ async fn finish_approval(
// lifecycle event. (It is never a first spawn — the agent already
// exists — so it never needs the Spawned arm above.)
ApprovalKind::MergeConfigPr => {
coord.notify_submitter(
approval.id,
&HelperEvent::Rebuilt {
agent: approval.agent.to_string(),
ok,
note,
sha: approval.fetched_sha.clone(),
tag: terminal_tag,
},
let summary = crate::coordinator::rebuilt_todo_summary(
approval.agent.as_str(),
ok,
note.as_deref(),
approval.fetched_sha.as_deref(),
terminal_tag.as_deref(),
);
coord
.push_todo_submitter(
approval.id,
"core",
Some(format!("rebuilt:{}", approval.agent)),
summary,
None,
)
.await;
}
// UpdateMetaInputs / SchedulePrompt: ApprovalResolved already
// carries the result. No separate lifecycle event needed.

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