Watch
0
0
Fork
You've already forked hyperhive
0

hive-agent: self-announce boot instead of host-side kick_agent

This commit is contained in:
damocles 2026-10-04 15:28:58 +02:00 • committed by mara
commit cd61ea4a37
4 changed files with 79 additions and 9 deletions

View file

@ -513,10 +513,16 @@ async fn run_rebuild_bookkeeping(coord: &Arc<Coordinator>, name: &str) -> Result
// access all recover without a hive-c0re restart. (No matrix step: the
// swarm mints an agent's matrix account, not this hive.)
crate::forge::sync_agent(name, crate::forge::core_token().as_deref()).await;
// Wake the agent on its next turn so claude sees a "you were rebuilt"
// hint; rescan so dashboards drop the "needs update" chip; lock bump →
// No `kick_agent` here any more — reporting from `hive-agent`'s own
// boot instead avoids the duplicate-restart-message problem this used
// to cause: the container is still stopped at this point (`swap_update` requires it stopped and
// never restarts it — the DAG's tail `Reconcile`/`Start` does), so a
// host-side "you were rebuilt" broker message would just queue
// alongside `run_start`'s own kick for the same boot. `hive-agent` now
// self-announces once on its own startup instead — one message per
// actual boot, not one per DAG node that happens to run during it.
// Rescan so dashboards drop the "needs update" chip; lock bump →
// meta-inputs re-render.
coord.kick_agent(name, "container rebuilt");
coord.rescan_containers_and_emit().await;
crate::dashboard::emit_meta_inputs_snapshot(coord);
Ok(())
@ -674,7 +680,9 @@ async fn run_start(coord: &Arc<Coordinator>, name: &str) -> Result<()> {
// (no background poll) — c0re owns the listener lifecycle, so
// register here rather than waiting for a sweep.
coord.register_agent(name)?;
coord.kick_agent(name, "container started");
// No `kick_agent` here any more — `hive-agent` pushes its own "you
// were just (re)started" todo on boot now, so this node doesn't need
// to tell it. See the matching comment in `run_rebuild_bookkeeping`.
coord.rescan_containers_and_emit().await;
Ok(())
}