Twitter recently announced it was laying off hundreds of workers. And among them is one of its senior engineers, who on Tuesday criticized the company's lack of diversity.

As an engineering manager at Twitter, Leslie Miley was one of the only African Americans in company leadership. His departure leaves Twitter with no "managers, directors, or VP’s of color in engineering or product management," Miley wrote in a blog post.

Miley said he'd grown increasingly frustrated with Twitter, where blacks account for more than 25 percent of the user base but just two percent of its U.S. workforce. His repeated interactions with senior management revealed tensions between Twitter's role as "an agent of revolutionary social change" on the one hand and a striking lack of "diversity of thought, conversation, and people in its ranks" on the other.

A key turning point in Miley's decision to leave was a meeting with Alex Roetter, Twitter's senior vice president of engineering. Though Miley didn't mention Roetter by name, he claimed that the executive agreed with Miley's request to keep better track of minorities in the hiring process — and then suggested that Miley develop a tool to guess the ethnicity of a job applicant based on his or her last name.

It's an approach that befits an engineer, said Miley, but it uncovered large gaps in the way Twitter's senior leadership thought about race and ethnicity, which isn't easily captured by surnames alone. Miley pointed to his own name as evidence: A computer algorithm would be unlikely to identify him as black.

Miley gave credit to newly returned chief executive Jack Dorsey and his recent commitments — both publicly and internally — to improving diversity. In August the company laid down concrete diversity targets for the coming year.

"We're committed to making substantive progress in making Twitter more diverse and inclusive," the company said in a statement. "This commitment includes the expansion of our inclusion and diversity programs, diversity recruiting, employee development, and resource group-led initiatives."

Miley isn't the only high-profile Twitter employee to leave the company over diversity issues. Mark Luckie, then Twitter's manager of journalism and news, left in May after seeing how few people of color are represented at U.S. tech companies. He now spends his time trying to boost the visibility of blacks in American media.

On Tuesday, Luckie had some words of encouragement for Miley, posting them — naturally — to Twitter.