diff --git a/hive-c0re/src/actions.rs b/hive-c0re/src/actions.rs index 9872e85c..e1ebd17c 100644 --- a/hive-c0re/src/actions.rs +++ b/hive-c0re/src/actions.rs @@ -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. diff --git a/hive-c0re/src/job_queue/exec.rs b/hive-c0re/src/job_queue/exec.rs index d1449bdd..311d1ce1 100644 --- a/hive-c0re/src/job_queue/exec.rs +++ b/hive-c0re/src/job_queue/exec.rs @@ -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, agent: &str, dag_id: Option, 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, agent: &str, dag_id: Option, 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