fix: call matrix::sync_agent on rebuild, mirrors startup sweep

This commit is contained in:
damocles 2026-06-01 13:43:02 +02:00 committed by mara
commit 044ff5523c
2 changed files with 35 additions and 0 deletions

View file

@ -119,6 +119,12 @@ pub async fn rebuild_agent(
// (e.g. first-spawn seeding failed transiently) without
// requiring a full hive-c0re restart.
crate::forge::sync_agent(name, crate::forge::core_token().as_deref()).await;
// Mirror the matrix side of the startup sweep: if hive-matrix
// is present, ensure this agent has a registered user + token.
// Idempotent (skips if token file already exists). Keeps the
// rebuild path equivalent to the startup sweep for newly-spawned
// agents that missed ensure_all().
crate::matrix::sync_agent_standalone(name).await;
// Wake the agent on its next turn so claude sees a
// "you were rebuilt — check /state/ for notes, --continue
// session intact" hint. Covers dashboard rebuild, admin