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

@ -70,7 +70,11 @@ where system-level facts live.
alongside its `flake.nix` regeneration. New agents land at their
default position (manager as parent, manager itself as root);
removed agents drop. Existing entries are preserved as-is so
operator overrides stick across regenerations.
operator overrides stick across regenerations. Pending-init agents
(an operator-approved proposed config repo but no container yet —
`Coordinator::pending_init_names`) are kept too, so the
`child -> parent` edge written when `request_init_config` is approved
survives the gap until the first apply-commit spawns the container.
3. **Inject**: `meta::render_flake` looks up each agent's parent and
passes it to `mkAgent`. When non-null, the mkAgent body sets
`HIVE_PARENT = parent` in the agent's systemd service environment
@ -121,7 +125,7 @@ can't:
| variant | semantic | post-milestone |
|---|---|---|
| `RequestInitConfig` | seed an agent's proposed config repo | **topology**descendants only |
| `RequestInitConfig` | seed an agent's proposed config repo | **topology**existing direct child (re-init) or a brand-new name (child added under self on approval); a name owned by a different parent is refused |
| `RequestApplyCommit` | submit a commit sha for operator approval | **topology** — descendants only |
| `Kill` / `Start` / `Restart` / `Update` | container lifecycle on an existing agent | **topology** — descendants only |
| `RequestUpdateMetaInputs` | bump meta `flake.lock` | **per-agent cap** (root-only today; a future "let coder bump its own input" might grant it) |