From d4eb62434d1de78c48d6918edfb3a269f38c81ef Mon Sep 17 00:00:00 2001 From: atlas Date: Sun, 30 Aug 2026 22:51:46 +0200 Subject: [PATCH] swarm-controller: creating an agent now asks its hive to deploy it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `TriggerDeploy` had no producer — a node kind nothing enqueues is dead code, and a publisher with no caller proves as little as a check nobody runs. It goes last in the creation chain, after `InitAgentConfigRepo` rather than merely after the repo exists: the hive deploys by reading that repo, so a deploy asked for any earlier would find nothing to build. That edge is what makes creating an agent at swarm level actually put it on a hive instead of leaving a provisioned name nobody runs. The `hive` it carries is the string this handler already parsed as an `Ident` and matched against the roster, so the node cannot name a hive this swarm does not have. --- swarm-controller/src/main.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/swarm-controller/src/main.rs b/swarm-controller/src/main.rs index 1ad2af1d..d7657dfb 100644 --- a/swarm-controller/src/main.rs +++ b/swarm-controller/src/main.rs @@ -914,9 +914,22 @@ async fn create_agent( }) .after_ok(create_repo) .after_ok(create_forge_user); - let _init_config = b - .node(SwarmNodeKind::InitAgentConfigRepo { agent }) + let init_config = b + .node(SwarmNodeKind::InitAgentConfigRepo { + agent: agent.clone(), + }) .after_ok(create_repo); + // Last, and specifically after the config repo is seeded: the + // hive deploys by reading that repo, so a deploy asked for any + // earlier would find nothing to build. This is the edge that + // makes creating an agent at swarm level actually put it on a + // hive, rather than leaving a provisioned name nobody runs. + let _trigger_deploy = b + .node(SwarmNodeKind::TriggerDeploy { + hive: hive.clone(), + agent, + }) + .after_ok(init_config); vec![create_identity.guid()] }) .map_err(|e| { @@ -1529,6 +1542,7 @@ mod tests { let deps = WorkerDeps { auth: None, forge: None, + queue: None, }; let runner = hive_jobq::scheduler::Scheduler::claim_next(&sched, move |id, kind, builder| { @@ -1580,6 +1594,7 @@ mod tests { let deps = WorkerDeps { auth: None, forge: None, + queue: None, }; let runner = hive_jobq::scheduler::Scheduler::claim_next(&sched, move |id, kind, builder| {