feat(#1014): rename manager agent root→ruth across all crates + frontend

This commit is contained in:
damocles 2026-06-02 17:02:01 +02:00 committed by mara
commit 89665b94de
19 changed files with 71 additions and 166 deletions

View file

@ -118,11 +118,6 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
}
ManagerRequest::Kill { name } => {
tracing::info!(%name, "manager: kill");
if name == crate::lifecycle::MANAGER_NAME {
return ManagerResponse::Err {
message: "refusing to kill the manager".into(),
};
}
let result: Result<()> = async {
lifecycle::kill(name).await?;
coord.unregister_agent(name);
@ -143,11 +138,6 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
}
ManagerRequest::Start { name } => {
tracing::info!(%name, "manager: start");
if name == crate::lifecycle::MANAGER_NAME {
return ManagerResponse::Err {
message: "refusing to start the manager from itself".into(),
};
}
match lifecycle::start(name).await {
Ok(()) => {
coord.kick_agent(name, "container started");
@ -160,11 +150,6 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
}
ManagerRequest::Restart { name } => {
tracing::info!(%name, "manager: enqueue restart");
if name == crate::lifecycle::MANAGER_NAME {
return ManagerResponse::Err {
message: "refusing to restart the manager from itself".into(),
};
}
coord.rebuild_queue.enqueue(
crate::rebuild_queue::QueueKind::Restart,
name.to_owned(),
@ -267,16 +252,9 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
}
ManagerRequest::GetLogs { agent, lines } => {
let n = lines.unwrap_or(50);
// `journalctl -M` wants the *machine* name, not the
// logical agent name: `gui` → `h-gui`. `container_name`
// does that and passes the manager name through unprefixed.
// The explicit check here keeps parity with the MANAGER_AGENT
// constant so the two never diverge.
let machine = if agent == MANAGER_AGENT {
crate::lifecycle::MANAGER_NAME.to_owned()
} else {
crate::lifecycle::container_name(agent)
};
// `journalctl -M` wants the container name (`h-<name>`),
// not the logical agent name. `container_name` adds the prefix.
let machine = crate::lifecycle::container_name(agent);
tracing::info!(%agent, %machine, %n, "manager: get_logs");
match tokio::process::Command::new("journalctl")
.args([
@ -322,7 +300,15 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc<Coordinator>) -> ManagerResp
}
ManagerRequest::GetLooseEnds { agent } => {
let result = match agent.as_deref() {
Some("*") => crate::loose_ends::hive_wide(coord),
Some("*") => {
// Hive-wide query requires query_agent_state capability.
if !crate::capabilities::has_cap(MANAGER_AGENT, hive_sh4re::Capability::QueryAgentState) {
return ManagerResponse::Err {
message: "query_agent_state capability required for hive-wide loose ends".into(),
};
}
crate::loose_ends::hive_wide(coord)
}
Some(name) => crate::loose_ends::for_agent(coord, name),
None => crate::loose_ends::for_agent(coord, MANAGER_AGENT),
};
@ -726,7 +712,7 @@ fn handle_edit_schedule(
}
/// Permission check for `CancelSchedule` on the manager surface.
/// `requester` (always `root` here) can cancel its own schedules.
/// `requester` (always `ruth` here) can cancel its own schedules.
/// Sub-agent ownership is delegated to topology — see
/// `crate::topology::is_descendant_of`. Also reused by
/// `handle_fire_schedule_now` — fire-auth follows the same shape.