diff --git a/crates/pm-agent-client/src/types.rs b/crates/pm-agent-client/src/types.rs index bce071e..efb3c76 100644 --- a/crates/pm-agent-client/src/types.rs +++ b/crates/pm-agent-client/src/types.rs @@ -184,7 +184,7 @@ pub struct ApplyPatchesResponse { #[derive(Debug, Clone, Deserialize, Serialize)] pub struct AgentJobStatus { pub job_id: String, - /// Current status: `"running"`, `"succeeded"`, `"failed"`, or `"cancelled"`. + /// Current status: `"queued"`, `"running"`, `"succeeded"`, `"completed"`, `"failed"`, or `"cancelled"`. pub status: String, pub progress_percent: Option, pub output: Option, diff --git a/crates/pm-worker/src/job_executor.rs b/crates/pm-worker/src/job_executor.rs index a4bab57..192cc93 100644 --- a/crates/pm-worker/src/job_executor.rs +++ b/crates/pm-worker/src/job_executor.rs @@ -552,7 +552,7 @@ async fn poll_single_host(pool: PgPool, config: Arc, row: PatchJobHos }; match status.status.as_str() { - "succeeded" => { + "succeeded" | "completed" => { tracing::info!(pjh_id = %row.id, "poll_single_host: agent job succeeded"); if let Err(e) = sqlx::query( r#" @@ -587,6 +587,13 @@ async fn poll_single_host(pool: PgPool, config: Arc, row: PatchJobHos "poll_single_host: job still in progress" ); }, + "cancelled" => { + tracing::info!(pjh_id = %row.id, "poll_single_host: agent job cancelled"); + let err_msg = status + .error + .unwrap_or_else(|| "Agent job was cancelled".to_string()); + handle_host_failure(pool, row.id, err_msg).await; + }, other => { tracing::warn!( pjh_id = %row.id,