apply_commit handles first-time spawns, request_spawn deprecated

This commit is contained in:
damocles 2026-05-22 09:20:50 +02:00
parent 6974634326
commit 66f1568e8f
6 changed files with 166 additions and 34 deletions

View file

@ -590,7 +590,9 @@ pub enum HelperEvent {
},
/// A new agent's proposed config repo was initialised (post-`InitConfig`
/// approval). The manager can now edit `/agents/<agent>/config/agent.nix`,
/// commit the changes, and submit a `RequestSpawn` to create the container.
/// commit the changes, and submit a `RequestApplyCommit` — which will
/// create the container on first deploy, then rebuild on every subsequent
/// deploy.
ConfigReady { agent: String },
/// A sub-agent's container was stopped (the systemd unit is down;
/// persistent state is unchanged).
@ -691,9 +693,11 @@ pub enum ManagerRequest {
/// approval for the operator to review. On approval hive-c0re seeds
/// `/agents/<name>/config/` with the default `agent.nix` template,
/// giving the manager RW access so it can customise the config and
/// commit changes before calling `request_spawn`. Fails if a proposed
/// commit changes. After the `ConfigReady` event arrives, edit
/// `agent.nix`, commit, and call `request_apply_commit` — which
/// creates the container on the first deploy. Fails if a proposed
/// repo for this name already exists (use `request_apply_commit` to
/// update an existing agent's config). Must precede `request_spawn`.
/// update an existing agent's config).
RequestInitConfig {
name: String,
/// Optional description shown on the dashboard approval card.
@ -704,6 +708,10 @@ pub enum ManagerRequest {
/// creates and starts the container. Requires a prior approved
/// `request_init_config` so the manager can customise `agent.nix` first.
/// Fails if the proposed config repo for this name does not exist yet.
///
/// Deprecated: prefer `request_apply_commit` after `config_ready` —
/// it pins the exact commit sha, handles both first-time spawns and
/// subsequent rebuilds, and always reflects the committed config.
RequestSpawn {
name: String,
/// Optional description shown on the dashboard approval card.