It was officially renewed after episode 6 streamed (just like the first season).
I'm pretty certain they designed things with the idea that they WOULD get a Season 3 - and if they didn't get a Season 3; CBS might either pony up for a reshoot of some final episode scenes, OR the writers designed it in sch a way that whatever they have in there relating to Season 3 could have been edited out, with the episode up to that point making enough sense; and they then include the 'what would have been' scenes as extras on the Blu-Ray release.
My bet is that it was internally renewed long before it was publically renewed. CBS has their subscriptions numbers. They know how many people watch the show. They know what bump came along in January.