hive-c0re: let request_init_config spawn a brand-new sub-agent under its requester

This commit is contained in:
damocles 2026-06-21 22:15:41 +02:00 committed by mara
commit b3d002e4a7
8 changed files with 254 additions and 23 deletions

View file

@ -314,6 +314,16 @@ async fn run_approval_init_config(
notes_dir: std::path::PathBuf,
) -> Result<()> {
let result: Result<()> = async {
// Place the new child under its requesting parent (carried in
// commit_ref by submit_init_config). An empty commit_ref means
// no explicit parent was named (privileged manager socket, or an
// approval queued before the new-child feature) — write no edge
// and let `topology::reconcile` assign the default position on
// first spawn, so this path never names a specific root agent.
if !approval.commit_ref.is_empty() {
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?;
lifecycle::ensure_agent_state_subvolume(&approval.agent).await?;
lifecycle::ensure_claude_dir(&claude_dir)?;