refactor: remove hyperhive.role option — there is only one role: agent

This commit is contained in:
damocles 2026-06-04 12:40:24 +02:00 committed by mara
commit 41eb3f806c
23 changed files with 105 additions and 229 deletions

View file

@ -547,12 +547,9 @@ async fn run_apply_commit(
// "nixos-container update" label for the whole multi-minute window.
let hive = coord.hive_env();
let paths = Coordinator::agent_paths(&approval.agent, agent_dir.to_path_buf());
let build_result = lifecycle::rebuild_no_meta(
&approval.agent,
&hive,
&paths,
&|step| coord.set_queue_step(queue_entry_id, step),
)
let build_result = lifecycle::rebuild_no_meta(&approval.agent, &hive, &paths, &|step| {
coord.set_queue_step(queue_entry_id, step)
})
.await;
match build_result {

View file

@ -463,7 +463,7 @@ async fn dispatch(req: &AgentRequest, agent: &str, coord: &Arc<Coordinator>) ->
Err(e) => {
return AgentResponse::Err {
message: format!("list containers failed: {e:#}"),
}
};
}
};
// Walk the full topology and collect every descendant.
@ -497,7 +497,8 @@ async fn dispatch(req: &AgentRequest, agent: &str, coord: &Arc<Coordinator>) ->
};
}
tracing::info!(%agent, %name, "agent: request_init_config for child");
match crate::manager_server::submit_init_config(coord, name, description.clone()).await {
match crate::manager_server::submit_init_config(coord, name, description.clone()).await
{
Ok(_id) => AgentResponse::Ok,
Err(e) => AgentResponse::Err {
message: format!("{e:#}"),

View file

@ -84,12 +84,9 @@ pub async fn rebuild_agent(
// lifecycle_action; this catches the auto-update scan + any
// other direct caller.
let guard = coord.transient_guard(name, crate::coordinator::TransientKind::Rebuilding);
let result = lifecycle::rebuild(
name,
&hive,
&paths,
&|step| coord.set_queue_step(queue_entry_id, step),
)
let result = lifecycle::rebuild(name, &hive, &paths, &|step| {
coord.set_queue_step(queue_entry_id, step)
})
.await;
drop(guard);
match &result {

View file

@ -478,8 +478,7 @@ async fn matrix_reset_password(name: &str) -> Result<()> {
);
}
let admin_token = hive_c0re::matrix::read_admin_token()?;
let new_password =
hive_c0re::matrix::random_password().context("generate random password")?;
let new_password = hive_c0re::matrix::random_password().context("generate random password")?;
let client = reqwest::Client::builder()
.timeout(std::time::Duration::from_secs(30))
.build()
@ -496,8 +495,7 @@ async fn matrix_reset_password(name: &str) -> Result<()> {
)
.await
.with_context(|| format!("matrix reset-password {name}"))?;
let pw_path = PathBuf::from("/var/lib/hyperhive/matrix-creds")
.join(format!("{name}-password"));
let pw_path = PathBuf::from("/var/lib/hyperhive/matrix-creds").join(format!("{name}-password"));
println!("matrix: password for @{name}:{server_name} reset");
println!("password persisted at: {}", pw_path.display());
println!("next: hivectl matrix create-user {name} # mints a fresh access token");

View file

@ -3037,18 +3037,17 @@ struct PushWebhookRepo {
async fn post_webhook_knowledge(
axum::extract::Json(payload): axum::extract::Json<PushWebhookPayload>,
) -> Response {
let expected_repo = format!(
"{}/{}",
crate::knowledge::ORG,
crate::knowledge::REPO
);
let expected_repo = format!("{}/{}", crate::knowledge::ORG, crate::knowledge::REPO);
let full_name = payload
.repository
.as_ref()
.and_then(|r| r.full_name.as_deref())
.unwrap_or("");
if full_name != expected_repo {
tracing::debug!(full_name, "webhook/knowledge: ignoring push from unexpected repo");
tracing::debug!(
full_name,
"webhook/knowledge: ignoring push from unexpected repo"
);
return (StatusCode::OK, "ignored").into_response();
}
let git_ref = payload.git_ref.as_deref().unwrap_or("");

View file

@ -355,7 +355,12 @@ pub(crate) async fn submit_init_config(
}
let id = coord
.approvals
.submit_kind(name, hive_sh4re::ApprovalKind::InitConfig, "", description.as_deref())
.submit_kind(
name,
hive_sh4re::ApprovalKind::InitConfig,
"",
description.as_deref(),
)
.map_err(|e| anyhow::anyhow!("queue approval row: {e:#}"))?;
tracing::info!(%id, %name, "init_config approval queued");
coord.emit_approval_added(id, name, "init_config", None, None, description);

View file

@ -340,9 +340,7 @@ fn backfill_manager_tool_groups(names: &[String]) {
}
let existing = tool_groups::groups_for(MANAGER_NAME);
if !existing.is_empty() {
tracing::debug!(
"migration: ruth already has explicit tool groups — skipping backfill"
);
tracing::debug!("migration: ruth already has explicit tool groups — skipping backfill");
return;
}
let all_groups: Vec<String> = hive_sh4re::ToolGroup::MANAGER_DEFAULT

View file

@ -202,7 +202,6 @@ fn known_agents(_coord: &Coordinator) -> std::collections::HashSet<String> {
if let Some(name) = raw.strip_prefix(crate::lifecycle::AGENT_PREFIX) {
out.insert(name.to_owned());
}
}
}
Err(e) => {
@ -378,7 +377,6 @@ async fn known_agents_async() -> std::collections::HashSet<String> {
if let Some(name) = raw.strip_prefix(crate::lifecycle::AGENT_PREFIX) {
out.insert(name.to_owned());
}
}
}
Err(e) => {

View file

@ -82,8 +82,7 @@ async fn dispatch(req: &HostRequest, coord: Arc<Coordinator>) -> HostResponse {
let agent_dir = coord.ensure_runtime(name)?;
let hive = coord.hive_env();
let paths = Coordinator::agent_paths(name, agent_dir);
match lifecycle::spawn(name, &hive, &paths).await
{
match lifecycle::spawn(name, &hive, &paths).await {
Ok(()) => {
coord.notify_manager(&hive_sh4re::HelperEvent::Spawned {
agent: name.clone(),