Phase 5a: approval queue (request_apply_commit, pending/approve/deny)

This commit is contained in:
müde 2026-05-14 22:50:19 +02:00
parent 4a73340150
commit f12837fe32
7 changed files with 270 additions and 0 deletions

View file

@ -81,6 +81,25 @@ async fn dispatch(req: &HostRequest, coord: &Coordinator) -> HostResponse {
HostResponse::success()
}
HostRequest::List => HostResponse::list(lifecycle::list().await?),
HostRequest::Pending => HostResponse::pending(coord.approvals.pending()?),
HostRequest::Approve { id } => {
let approval = coord.approvals.mark_approved(*id)?;
tracing::info!(%approval.id, %approval.agent, %approval.commit_ref, "approval applied: rebuilding agent");
let agent_dir = coord.register_agent(&approval.agent).await?;
if let Err(e) =
lifecycle::rebuild(&approval.agent, &coord.agent_flake, &agent_dir).await
{
let note = format!("{e:#}");
let _ = coord.approvals.mark_failed(approval.id, &note);
return Err(e);
}
HostResponse::success()
}
HostRequest::Deny { id } => {
coord.approvals.mark_denied(*id)?;
tracing::info!(%id, "approval denied");
HostResponse::success()
}
})
}
.await;