How does a combustion process produce carbon monoxide? My question is in the context of combustion heater safety- I want to identify the mechanism by which CO is produced, and hopefully have additional understanding, and clues to the warning signs, to identify unsafe stoves or installations. The primary safety measures will always be CO detectors and good ventilation.

The worst horror stories usually concern charcoal barbecues in confined spaces- solid carbon burning at about 900 °C. Is it a safe educated guess that the main combustion product here is CO, which fails to burn fully to CO2 in depleted oxygen levels? Or is a more complex process at work?

How does the yellow combustion of an oil or gas flame produce CO? Is it a simple matter of poor gas flow in the flue, and depleted oxygen in the feed air?

Thanks for any help
If combustion occurs in oxygen, (at least) the following reactions are relevant:
$$\ce{C + O2 -&gt; CO2} $$
$$\ce{C + 1/2 O2 -&gt; CO} $$

You can favor the first reaction by having more oxygen in the gas phase, since it required twice $\ce{O2}$ as the first.

However, one of the most important factors is the temperature: high temperature always favors the $\ce{CO}$ product, since reaction wants to proceed fast and react with any available oxygen.
You can clearly see these dependences in the Figure 6 of this article, at low temperatures the CO/CO2 ratio is low, but quickly increases by heating.

More detailed information is easily found in some classical papers, a full PhD thesis on it, or even calculations with modern quantum chemistry methods.