feat: group host-side /var/lib/hyperhive state into db/ forge/ matrix/ run/ subdirs with startup migration

This commit is contained in:
damocles 2026-06-05 22:48:10 +02:00 committed by mara
commit 14c7b0d406
15 changed files with 261 additions and 51 deletions

View file

@ -54,7 +54,7 @@ enum Cmd {
#[arg(long, default_value = "")]
nixpkgs_unstable_flake: String,
/// Path to the sqlite message store.
#[arg(long, default_value = "/var/lib/hyperhive/broker.sqlite")]
#[arg(long, default_value = hive_c0re::paths::BROKER_DB)]
db: PathBuf,
/// Dashboard HTTP port.
#[arg(long, default_value_t = 7000)]
@ -223,6 +223,11 @@ async fn cmd_serve(
agent_memory_max: String,
socket: &std::path::Path,
) -> Result<()> {
// Move any host-side state still at the legacy flat layout into its
// subdir (`db/`, `forge/`, `matrix/`, `run/`) BEFORE opening the
// broker db — the broker + build-logs dbs are among the relocated
// files. Idempotent; a no-op once migrated.
hive_c0re::paths::relocate_legacy_state();
let cwt: std::collections::HashMap<String, u64> = serde_json::from_str(&context_window_tokens)
.context("--context-window-tokens: invalid JSON")?;
let coord = Arc::new(Coordinator::open(