From d06b598c56cac1b6c9cbac2e14e6d4215c69ca9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?m=C3=BCde?= Date: Sat, 16 May 2026 04:20:01 +0200 Subject: [PATCH] kick_agent on every rebuild + apply path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit agents weren't being woken with the 'you were rebuilt — check /state/ for notes, --continue intact' system message after several recent rebuild surfaces: - auto_update::rebuild_agent — used by the dashboard rebuild button, admin-CLI rebuild via lifecycle_action, the startup rev-scan, AND the new meta-input update batch loop. kick moves *into* rebuild_agent's success arm so all four paths benefit. (the dashboard's lifecycle_action extra closure was already firing kick — now it's a no-op for the rebuild path since rebuild_agent does it.) - actions::run_apply_commit — apply-commit approve flow built + tagged deployed/ but never kicked. add kick on success with the more specific 'config update applied' hint. - server.rs::HostRequest::Rebuild — the admin-CLI direct path calls lifecycle::rebuild bypassing rebuild_agent. add kick on success. dashboard's restart / start lifecycle_action extras still kick via their own closures since they don't route through rebuild_agent. stop / kill / destroy intentionally don't kick — there's nothing to wake. --- hive-c0re/src/actions.rs | 9 ++++++--- hive-c0re/src/auto_update.rs | 7 +++++++ hive-c0re/src/dashboard.rs | 4 +++- hive-c0re/src/server.rs | 21 ++++++++++++++------- 4 files changed, 30 insertions(+), 11 deletions(-) diff --git a/hive-c0re/src/actions.rs b/hive-c0re/src/actions.rs index c7cc5f4..5e9a0ab 100644 --- a/hive-c0re/src/actions.rs +++ b/hive-c0re/src/actions.rs @@ -239,9 +239,12 @@ async fn run_apply_commit( // operator can git-commit by hand if they care. tracing::warn!(agent = %approval.agent, %id, error = ?e, "meta finalize_deploy failed"); } - // Don't ignore the coord pointer — keeps the borrow alive - // for future tracing additions without re-plumbing. - let _ = coord; + // Wake the agent on its next turn so claude sees the + // config change took effect. Same hint pattern as + // auto_update::rebuild_agent — manager approved a + // proposal, agent picks up where it left off with the + // new env / packages. + coord.kick_agent(&approval.agent, "config update applied"); (Ok(()), Some(tag)) } Err(e) => { diff --git a/hive-c0re/src/auto_update.rs b/hive-c0re/src/auto_update.rs index ac3bc7b..b07f1e5 100644 --- a/hive-c0re/src/auto_update.rs +++ b/hive-c0re/src/auto_update.rs @@ -88,6 +88,13 @@ pub async fn rebuild_agent(coord: &Arc, name: &str, current_rev: &s sha: None, tag: None, }); + // 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 + // CLI rebuild, auto-update startup scan, and the + // dashboard's meta-input update path — all of which + // route through rebuild_agent. + coord.kick_agent(name, "container rebuilt"); } Err(e) => { coord.notify_manager(&hive_sh4re::HelperEvent::Rebuilt { diff --git a/hive-c0re/src/dashboard.rs b/hive-c0re/src/dashboard.rs index cdf4be3..4fdb417 100644 --- a/hive-c0re/src/dashboard.rs +++ b/hive-c0re/src/dashboard.rs @@ -1093,7 +1093,9 @@ async fn post_rebuild(State(state): State, AxumPath(name): AxumPath) -> HostResponse { // agent.nix). Without this the admin-socket CLI was // a notify-gap. match &result { - Ok(()) => coord.notify_manager(&hive_sh4re::HelperEvent::Rebuilt { - agent: name.clone(), - ok: true, - note: None, - sha: None, - tag: None, - }), + Ok(()) => { + coord.notify_manager(&hive_sh4re::HelperEvent::Rebuilt { + agent: name.clone(), + ok: true, + note: None, + sha: None, + tag: None, + }); + // Wake the agent's next turn with the + // "you were rebuilt" hint. Same pattern as + // auto_update::rebuild_agent and the dashboard + // rebuild path — this is the CLI's equivalent. + coord.kick_agent(name, "container rebuilt"); + } Err(e) => coord.notify_manager(&hive_sh4re::HelperEvent::Rebuilt { agent: name.clone(), ok: false,