use crate::assistant::{config::Seat, permission::Issuer, record::Record, tools::Identity};
pub(super) async fn record(
seat: &Seat,
identity: &Identity,
error: &anyhow::Error,
) -> anyhow::Result<()> {
let issuer = Issuer::new(seat, identity)?;
let person = issuer.responsible(&identity.pass).await?;
let seat = seat.clone();
let identity = Identity {
agent: identity.agent.clone(),
launch: identity.launch.clone(),
pass: identity.pass.clone(),
};
let reason = format!("the harness could not start: {error}");
tokio::task::spawn_blocking(move || Record::startup_failure(seat, &identity, person, &reason))
.await
.map_err(|_| anyhow::anyhow!("assistant_startup_record_worker_failed"))?
}