Leadership is a breeze when everything is going well for a company. It's only when there's a crisis that you can distinguish a capable leader from a disastrous one -- that you can tell, as Warren Buffett put it, who's been swimming without trunks. 

"Silicon Valley" has offered up a lot of villains to blame for the precarious state of Pied Piper: greedy billionaires, craven venture capitalists, unethical rivals. But maybe the real problem all along has been the man-boy in charge. 

Yes, Richard is the coding savant who built a compression algorithm so good, even mighty Hooli can't figure out how to duplicate it. But he's also timid, inarticulate, pathologically conflict-avoidant and crippled by anxiety. These aren't the qualities of an empire-builder. 

Pied Piper is facing its biggest test since TechCrunch Disrupt, when a filthy time-wasting tangent provided the solution the team needed at the last possible moment. Intersite, the giant video porn provider, has agreed to let Pied Piper challenge End Frame in a bake-off, with the winner securing a $15 million contract. 

It's a mission that requires everyone's full focus, but Richard allows himself to become distracted when he finds out an acquaintance named Seth, who was in charge of security at End Frame, was fired after Pied Piper stole the details of the agreement with Intersite. Racked by guilt, Richard meets up with Seth and tries to make him feel better by telling him the security breach was a result of an errant Post-It note, not a hack. 

Instead of feeling reassured, however, Seth goes ballistic, vowing to take revenge on Pied Piper. With the bake-off looming, it would be a catastrophic time to get hacked. Gilfoyle assures Richard that his security is unbreachable and begs him to calm down and get back to work. But Richard can't stop perseverating. Against the urging of his team, he reaches out to Seth again, and again it backfires. When the bake-off arrives, it's little reassurance that it's a blunder by the idiotic Russ rather than a hack that causes Hooli to lose. 

The only "good" news is that Gavin is handling his own crisis just as poorly. He has given up on making Nucleus a success; now his only goal is to make sure he doesn't suffer for it professionally. Toward that end, he convinces the brilliant Davis Bannerchek to come back to Hooli and head up the project. It looks like Gavin has found a convincing scapegoat, but Davis takes one look at the situation he's walking into and quits on the spot. 

Improbably, the only one displaying anything resembling real leadership is, once again, Erlich. He secures a pitch meeting at Raviga Capital for his new protege, Jian Yang, who causes a mini-crisis when he outs Monica to her co-workers as a smoker. "This is Palo Alto. People are lunatics about smoking here," Erlich lectures Jian Yang. "We don't enjoy all the freedoms you have in China." 

But Erlich turns the faux pas into gold by rethinking the app they're pitching as one for avoiding second-hand smoke instead of crowded playgrounds. He's unconventional, and more than a bit of a tool, but Erlich's boldness goes a long way in a world of cowards and frauds.