Is there some consensus among historians on who was the first programmer ever? If so, who was it and what were they programming on?

I find it more interesting to know more about the pioneers of programming, regardless if they programmed on a programmable machine or if they've designed the machine themselves to do some computing task.

Augusta Ada King, Countess of Lovelace (1815 - 1852) is credited by most as the first programmer. 

The first program was an algorithm to calculate Bernoulli numbers for Charles Babbage's Analytical Engine, and it appeared in her translation notes of Luigi Menabrea's memoir "Sketch of the Analytical Engine Invented by Charles Babbage", more specifically Note G. That said, the math necessary for calculating Bernoulli numbers were known long before Ada's time, however Ada's algorithm is the first instance of a calculating algorithm designed to be executed by a (at the time still hypothetical) machine.

Konrad Zuse (1910 – 1995) is also a solid candidate for the "first programmer" moniker, having invented a floating point binary mechanical calculator with limited programmability, the Z1 (1936) but more importantly the Z3 (1941), a Turing complete electro-mechanical computer. 

When it comes to electronic computers, the Atanasoff–Berry Computer (conceived in 1937, operational by 1942) is credited as the first electronic digital computing device, so it's reasonable to think of its designers, John Vincent Atanasoff and Clifford Berry as programming pioneers. The Atanasoff–Berry Computer wasn't programmable though, the first programmable electronic computer was ENIAC (1946). 

Although ENIAC's designers John Mauchly and J. Presper Eckert probably did a fair share of programming, most of ENIAC's programming were done by these lovely ladies:


  


Their names from left to right are Kathy Kleiman1, Jean Bartik, Marlyn Meltzer, Kay Mauchly Antonelli and Betty Holberton at the front. Two of the ENIAC's female programmers, Fran Bilas and Ruth Lichterman, are missing from the photo.

When it comes to digital computers, the first one was Colossus (operational by December 1943), and the project's lead Tommy Flowers (1905 – 1998) should also be considered a programming pioneer, along with Max Newman (1897 – 1984) who was responsible for formulating the requirements for the machine and of course Alan Turing (1912 – 1954), who had designed Bletchley Park's earlier electromechanical cryptanalytical machine, the Bombe (1939), and was influential in Colossus design2.

1 Kathy Kleiman is the founder of the ENIAC Programmers Project and obviously not an ENIAC programmer (too young :)
2 A History of Computing in the Twentieth Century: The Colossus - B. Randell, Newcastle University (PDF)
