diff --git a/hive-c0re/src/workers/crash_watch.rs b/hive-c0re/src/workers/crash_watch.rs index 73999f1c..df41815f 100644 --- a/hive-c0re/src/workers/crash_watch.rs +++ b/hive-c0re/src/workers/crash_watch.rs @@ -56,7 +56,8 @@ pub fn spawn(coord: Arc) { ¤t_logged_in, &sub_agents, &prev_sub_agents, - ); + ) + .await; } // Periodic container rescan — catches state flips that // happen outside our mutation surface (operator runs @@ -122,7 +123,7 @@ fn is_deliberate_stop(active: Option, recently_cleared: Option) -> b active.unwrap_or(false) || recently_cleared.unwrap_or(false) } -fn emit_login_transitions( +async fn emit_login_transitions( coord: &Coordinator, prev: &HashSet, current: &HashSet, @@ -131,9 +132,15 @@ fn emit_login_transitions( ) { for agent in current.difference(prev) { tracing::info!(%agent, "agent logged in"); - coord.notify_manager(&hive_sh4re::HelperEvent::LoggedIn { - agent: agent.clone(), - }); + coord + .push_todo( + hive_sh4re::MANAGER_AGENT, + "core", + Some(format!("logged_in:{agent}")), + format!("agent '{agent}' logged in"), + None, + ) + .await; } // Detect transitions into "needs login": an agent that was previously // logged-in goes unsigned (credentials deleted), OR a brand-new agent @@ -156,9 +163,15 @@ fn emit_login_transitions( .collect(); for agent in current_needs.difference(&prev_needs) { tracing::info!(%agent, "agent needs login"); - coord.notify_manager(&hive_sh4re::HelperEvent::NeedsLogin { - agent: (*agent).to_owned(), - }); + coord + .push_todo( + hive_sh4re::MANAGER_AGENT, + "core", + Some(format!("needs_login:{agent}")), + format!("agent '{agent}' needs login"), + None, + ) + .await; } }