build agents only from internal/meta; delete the hive's local meta flake
The hive no longer renders, locks or commits a meta flake. A rebuild's MetaSync node picks the internal/meta commit and records it with the hyperhive and config pins it holds; Prebuild, Swap and Create build from it, and a head that does not pin the agent's current config fails the build naming the agent. hive-priv's meta_rev is required. Removed: meta.rs sync/lock/render, the manual-rebuild relock, the boot sweep's hyperhive bump (MetaLock), the update-meta-inputs form and its panel, MetaWindow, the hive's hyperhive_rev setting. Kept: agent_set::refresh holds what sync_agents also did (topology.json, the gateway's agent-socket map and nginx include), called from spawn, destroy, rebuild and the migration. The boot reconcile and the stale-start upgrade compare the agent's marker with the hyperhive pin of internal/meta; the dashboard's deployed chip reads the config marker a successful build writes.
This commit is contained in:
parent
cea4827918
commit
4aa11b3a94
1 changed files with 1042 additions and 3793 deletions
|
|
@ -1,5 +1,5 @@
|
|||
//! Startup convergence. Three phases, all idempotent and unguarded:
|
||||
//! harness files, applied + proposed repos, meta repo. They re-run every
|
||||
//! harness files, applied + proposed repos, the agent-set files. They re-run every
|
||||
//! boot on purpose — each one is a no-op once its state is already
|
||||
//! correct.
|
||||
//!
|
||||
|
|
@ -19,7 +19,6 @@
|
|||
//! details: `docs/agent-lifecycle/config-changes.md::Startup migrations (older hosts)`.
|
||||
|
||||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
|
|
@ -27,7 +26,6 @@ use tokio::process::Command;
|
|||
|
||||
use crate::coordinator::Coordinator;
|
||||
use crate::lifecycle::{self, AGENT_PREFIX};
|
||||
use crate::meta;
|
||||
|
||||
const KILL_SWITCH: &str = "HIVE_SKIP_META_MIGRATION";
|
||||
|
||||
|
|
@ -47,7 +45,7 @@ const GIT_TIMEOUT: Duration = Duration::from_mins(2);
|
|||
/// (raw `import ./agent.nix`) get rewritten on next hive-c0re start.
|
||||
const MODULE_FLAKE_MARKER: &str = "_module.args.flakeInputs";
|
||||
|
||||
pub async fn run(coord: &Arc<Coordinator>) -> Result<()> {
|
||||
pub async fn run() -> Result<()> {
|
||||
if std::env::var(KILL_SWITCH).is_ok() {
|
||||
tracing::info!("migration: {KILL_SWITCH} set — skipping");
|
||||
return Ok(());
|
||||
|
|
@ -107,21 +105,21 @@ pub async fn run(coord: &Arc<Coordinator>) -> Result<()> {
|
|||
}
|
||||
}
|
||||
|
||||
// Phase 3: meta repo.
|
||||
tracing::debug!("migration: phase 3 (meta sync_agents)");
|
||||
// `sync_agents` renders exactly the agents it is given, so an empty
|
||||
// stand-in for an unreadable list would drop every agent from the flake.
|
||||
// Phase 3: the files that follow the agent set.
|
||||
tracing::debug!("migration: phase 3 (agent_set refresh)");
|
||||
// `refresh` takes the agents it is given as the whole set, so an empty
|
||||
// stand-in for an unreadable list would drop every agent from the topology.
|
||||
let agents = match lifecycle::agents_for_meta_listing().await {
|
||||
Ok(agents) => agents,
|
||||
Err(e) => {
|
||||
tracing::warn!(error = ?e, "migration: container list failed; skipping meta sync_agents");
|
||||
tracing::warn!(error = ?e, "migration: container list failed; skipping agent_set refresh");
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
match tokio::time::timeout(GIT_TIMEOUT, meta::sync_agents(&coord.hive_env(), &agents)).await {
|
||||
Ok(Err(e)) => tracing::warn!(error = ?e, "migration: meta sync_agents failed"),
|
||||
match tokio::time::timeout(GIT_TIMEOUT, crate::agent_set::refresh(&agents)).await {
|
||||
Ok(Err(e)) => tracing::warn!(error = ?e, "migration: agent_set refresh failed"),
|
||||
Err(_) => {
|
||||
tracing::warn!(timeout = ?GIT_TIMEOUT, "migration: meta sync_agents timed out — skipping");
|
||||
tracing::warn!(timeout = ?GIT_TIMEOUT, "migration: agent_set refresh timed out — skipping");
|
||||
}
|
||||
Ok(Ok(())) => {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue