This is a good summary of the current consensus:
It is clear from our analysis that viruses closely related to SARS-CoV-2 have been circulating in horseshoe bats for many decades. The unsampled diversity descended from the SARS-CoV-2/RaTG13 common ancestor forms a clade of bat sarbecoviruses with generalist properties—with respect to their ability to infect a range of mammalian cells—that facilitated its jump to humans and may do so again. Although the human ACE2-compatible RBD was very likely to have been present in a bat sarbecovirus lineage that ultimately led to SARS-CoV-2, this RBD sequence has hitherto been found in only a few pangolin viruses. Furthermore, the other key feature thought to be instrumental in the ability of SARS-CoV-2 to infect humans—a polybasic cleavage site insertion in the S protein—has not yet been seen in another close bat relative of the SARS-CoV-2 virus.
b) Genetic analysis indicates that it most likely came from bats directly to humans, but picked up the ACE2 receptors from a Pangolin virus that was passed back to bats, evolved there and then infected humans. To quote the same nature article I lined above:
However, on closer inspection, the relative divergences in the phylogenetic tree (Fig. 2, bottom) show that SARS-CoV-2 is unlikely to have acquired the variable loop from an ancestor of Pangolin-2019 because these two sequences are approximately 10–15% divergent throughout the entire S protein (excluding the N-terminal domain). It is RaTG13 that is more divergent in the variable-loop region (Extended Data Fig. 1) and thus likely to be the product of recombination, acquiring a divergent variable loop from a hitherto unsampled bat sarbecovirus28. This is notable because the variable-loop region contains the six key contact residues in the RBD that give SARS-CoV-2 its ACE2-binding specificity27,37. These residues are also in the Pangolin Guangdong 2019 sequence. The most parsimonious explanation for these shared ACE2-specific residues is that they were present in the common ancestors of SARS-CoV-2, RaTG13 and Pangolin Guangdong 2019, and were lost through recombination in the lineage leading to RaTG13. This provides compelling support for the SARS-CoV-2 lineage being the consequence of a direct or nearly-direct zoonotic jump from bats, because the key ACE2-binding residues were present in viruses circulating in bats.
and:
Although the human ACE2-compatible RBD was very likely to have been present in a bat sarbecovirus lineage that ultimately led to SARS-CoV-2, this RBD sequence has hitherto been found in only a few pangolin viruses.