hive-c0re: let request_init_config spawn a brand-new sub-agent under its requester
This commit is contained in:
parent
63a79d76ba
commit
b3d002e4a7
8 changed files with 254 additions and 23 deletions
|
|
@ -151,7 +151,11 @@ fn handle_manager_init_config(
|
|||
description: Option<String>,
|
||||
) -> ManagerResponse {
|
||||
tracing::info!(%name, "manager: request_init_config");
|
||||
match submit_init_config(coord, name, description) {
|
||||
// No explicit parent edge from the privileged socket — the new
|
||||
// agent takes `topology::reconcile`'s default position on first
|
||||
// spawn. The agent socket is the path that records an explicit
|
||||
// requester-as-parent edge.
|
||||
match submit_init_config(coord, name, None, description) {
|
||||
Ok(_id) => ManagerResponse::Ok,
|
||||
Err(e) => ManagerResponse::Err {
|
||||
message: format!("{e:#}"),
|
||||
|
|
@ -403,9 +407,20 @@ pub(crate) fn validate_commit_ref(commit_ref: &str) -> Result<()> {
|
|||
|
||||
/// Queue an `InitConfig` approval for a brand-new agent whose config repo
|
||||
/// does not yet exist. Shared between the manager and agent sockets.
|
||||
///
|
||||
/// `parent`, when `Some`, is the agent that will own the new child once
|
||||
/// the operator approves: it is stashed in the approval's `commit_ref`
|
||||
/// field (unused for `InitConfig` otherwise — same pattern
|
||||
/// `UpdateMetaInputs` uses to carry its inputs JSON) and consumed in
|
||||
/// `run_approval_init_config` to write the `child -> parent` topology
|
||||
/// edge. The agent socket passes the requesting agent. `None` (the
|
||||
/// privileged manager socket) writes no explicit edge — the new agent
|
||||
/// lands at `topology::reconcile`'s default position when it first
|
||||
/// spawns, so no caller has to name a specific root agent here.
|
||||
pub(crate) fn submit_init_config(
|
||||
coord: &Arc<Coordinator>,
|
||||
name: &str,
|
||||
parent: Option<&str>,
|
||||
description: Option<String>,
|
||||
) -> anyhow::Result<i64> {
|
||||
let proposed_dir = crate::coordinator::Coordinator::agent_proposed_dir(name);
|
||||
|
|
@ -421,7 +436,7 @@ pub(crate) fn submit_init_config(
|
|||
.submit_kind(
|
||||
name,
|
||||
hive_sh4re::ApprovalKind::InitConfig,
|
||||
"",
|
||||
parent.unwrap_or(""),
|
||||
description.as_deref(),
|
||||
)
|
||||
.map_err(|e| anyhow::anyhow!("queue approval row: {e:#}"))?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue