diff --git a/x-pack/plugins/fleet/server/services/agents/action_status.ts b/x-pack/plugins/fleet/server/services/agents/action_status.ts index a057af185a066..7ab162b0aef79 100644 --- a/x-pack/plugins/fleet/server/services/agents/action_status.ts +++ b/x-pack/plugins/fleet/server/services/agents/action_status.ts @@ -64,12 +64,13 @@ export async function getActionStatuses( const matchingBucket = (acks?.aggregations?.ack_counts as any)?.buckets?.find( (bucket: any) => bucket.key === action.actionId ); + const nbAgentsActioned = action.nbAgentsActioned || action.nbAgentsActionCreated; const nbAgentsAck = Math.min( matchingBucket?.doc_count ?? 0, - (matchingBucket?.agent_count as any)?.value ?? 0 + (matchingBucket?.agent_count as any)?.value ?? 0, + nbAgentsActioned ); const completionTime = (matchingBucket?.max_timestamp as any)?.value_as_string; - const nbAgentsActioned = action.nbAgentsActioned || action.nbAgentsActionCreated; const complete = nbAgentsAck >= nbAgentsActioned; const cancelledAction = cancelledActions.find((a) => a.actionId === action.actionId);