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

View file

@ -109,7 +109,7 @@ pub(super) async fn run_node(
outcome, outcome,
} => run_resolve_approval(coord, coord.job_queue.dag_of(id), *approval_id, *outcome).await, } => run_resolve_approval(coord, coord.job_queue.dag_of(id), *approval_id, *outcome).await,
NodeKind::EmitRebuilt { ok, .. } => { 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(()) Ok(())
} }
NodeKind::SetWanted { up, .. } => run_set_wanted(coord, agent, *up), NodeKind::SetWanted { up, .. } => run_set_wanted(coord, agent, *up),
@ -144,19 +144,23 @@ async fn run_resolve_approval(
Ok(()) 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 /// 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*. /// 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) { async fn run_emit_rebuilt(coord: &Arc<Coordinator>, agent: &str, dag_id: Option<u64>, ok: bool) {
coord.notify_manager(&hive_sh4re::HelperEvent::Rebuilt { let note = (!ok)
agent: agent.to_owned(), .then(|| dag_id.and_then(|dag| coord.job_queue.first_error(dag)))
ok, .flatten();
note: (!ok) let summary = crate::coordinator::rebuilt_todo_summary(agent, ok, note.as_deref(), None, None);
.then(|| dag_id.and_then(|dag| coord.job_queue.first_error(dag))) coord
.flatten(), .push_todo(
sha: None, hive_sh4re::MANAGER_AGENT,
tag: None, "core",
}); Some(format!("rebuilt:{agent}")),
summary,
None,
)
.await;
} }
/// Write the agent's durable power intent — the DAG-node form of the old /// Write the agent's durable power intent — the DAG-node form of the old