fix #289: re-seed forge token in rebuild_agent

if forge_after_first_spawn fails transiently on first spawn the
token is missing. rebuild_agent now calls ensure_user_for so
a manual rebuild (or the startup auto-update scan) recovers
the missing token — no full hive reboot needed.
This commit is contained in:
damocles 2026-05-22 21:51:41 +02:00 committed by Mara
parent 2f1b846baf
commit 7ad9809207

View file

@ -101,6 +101,13 @@ pub async fn rebuild_agent(coord: &Arc<Coordinator>, name: &str, current_rev: &s
sha: None, sha: None,
tag: None, tag: None,
}); });
// Re-seed the forge token on every rebuild so a missing
// token (e.g. first-spawn seeding failed transiently) is
// fixed by the next rebuild rather than requiring a full
// hive-c0re restart.
if let Err(e) = crate::forge::ensure_user_for(name).await {
tracing::warn!(%name, error = ?e, "forge: ensure_user after rebuild failed");
}
// Wake the agent on its next turn so claude sees a // Wake the agent on its next turn so claude sees a
// "you were rebuilt — check /state/ for notes, --continue // "you were rebuilt — check /state/ for notes, --continue
// session intact" hint. Covers dashboard rebuild, admin // session intact" hint. Covers dashboard rebuild, admin