hive-c0re: create the agent subvolume before seeding dirs in init_config

This commit is contained in:
damocles 2026-06-21 23:34:34 +02:00 committed by mara
commit 1caf978004

View file

@ -324,8 +324,15 @@ async fn run_approval_init_config(
crate::topology::add_child(&approval.agent, &approval.commit_ref)
.map_err(|e| anyhow::anyhow!("topology add_child: {e}"))?;
}
lifecycle::setup_proposed(&proposed_dir, &approval.agent).await?;
// Create the agent's state root as a btrfs subvolume FIRST, before
// any dir-seed touches it. `ensure_agent_state_subvolume` is
// progressive ("root exists → skip"), and `setup_proposed` does a
// `create_dir_all` on the proposed-config path which would
// materialise the state root as a plain directory — after which
// the subvolume create is silently skipped and the agent never
// lands on a subvolume (no quota, no snapshot). Order matters.
lifecycle::ensure_agent_state_subvolume(&approval.agent).await?;
lifecycle::setup_proposed(&proposed_dir, &approval.agent).await?;
lifecycle::ensure_claude_dir(&claude_dir)?;
lifecycle::ensure_state_dir(&notes_dir)?;
Ok(())