rebuild re-registers agent; preserve /run/hyperhive across restarts

This commit is contained in:
müde 2026-05-14 22:13:00 +02:00
parent 746132d41e
commit af464e27f4
3 changed files with 5 additions and 1 deletions

View file

@ -26,6 +26,9 @@ impl Coordinator {
}
pub async fn register_agent(&self, name: &str) -> Result<PathBuf> {
// Idempotent: drop any existing listener so re-registration (e.g. on rebuild,
// or after a hive-c0re restart cleared /run/hyperhive) gets a fresh socket.
self.unregister_agent(name);
let agent_dir = Self::agent_dir(name);
std::fs::create_dir_all(&agent_dir)
.with_context(|| format!("create agent dir {}", agent_dir.display()))?;

View file

@ -77,7 +77,7 @@ async fn dispatch(req: &HostRequest, agent_flake: &str, coord: &Coordinator) ->
}
HostRequest::Rebuild { name } => {
tracing::info!(%name, "rebuild");
let agent_dir = Coordinator::agent_dir(name);
let agent_dir = coord.register_agent(name).await?;
lifecycle::rebuild(name, agent_flake, &agent_dir).await?;
HostResponse::success()
}

View file

@ -37,6 +37,7 @@ in
RestartSec = 2;
RuntimeDirectory = "hyperhive";
RuntimeDirectoryMode = "0750";
RuntimeDirectoryPreserve = "yes";
StateDirectory = "hyperhive";
};
};