© Olivier Douliery/Pool/Sipa USA/TNS The CIA seal is seen on the floor during a visit by U.S. President Donald Trump on Jan. 21, 2017 at the CIA headquarters in Langley, Va.

WASHINGTON — When wayward contract employees at the CIA began pilfering snacks from vending machines back in 2013, the Office of the Inspector General sprang into action. Surveillance cameras went up, the culprits were nabbed, and all lost their jobs.

From start to finish, the case of the $3,314.40 in stolen snacks lasted two months.

When more serious allegations of wrongdoing arise at the CIA, though, inspectors may be far less speedy, especially when their findings could embarrass the Langley, Va., spy agency.

In one notable case, that of John Reidy, a contractor whose resume shows that he worked with spies deep inside Iran’s mullah-run regime, charges of wrongdoing have sat idle in the hands of CIA inspectors. Details of Reidy’s charges remain highly classified. The case is now 7 years old, and seems only to gather dust.

Reidy, 46, anguishes over his charges, angry at the yearslong delay in resolving his complaints but also wary of crossing a line and revealing anything classified beyond his allegations of a “catastrophic intelligence failure” overseas.

“I cannot talk about the 2007 incident. It is classified. I risk incarceration. I have a family,” Reidy wrote in an email before meeting with a reporter.

But in addition to his whistleblower case, Reidy presses a larger issue, one that is pertinent to the era of President Donald Trump and his persistent charges that sensitive leaks cripple his six-month-old administration. Leaks may grow worse if intelligence agencies don’t learn how to channel dissent and protect those who offer it in a constructive spirit.

“I played by the rules,” Reidy said. “They are broken. … The public has to realize that whistleblowers (like me) can follow all the rules and nothing gets done.” In frustration, Reidy last month sent a 90-page letter and documentation about his case to the chairman of the Senate’s powerful Judiciary Committee, lambasting its lack of resolution.

“They have enough time to look into who is stealing candy from a vending machine but they can’t look into billion-dollar contract fraud?” Reidy asked in an interview.

The CIA refused to comment on Reidy’s case.

“As a general matter, we do not comment on ongoing litigation,” said spokesperson Heather Fritz Horniak.

Even if CIA officials have a far different version of events, perhaps contradicting some of Reidy’s allegations, the secrecy with which the agency operates impedes them from speaking out. CIA Director Mike Pompeo said in a speech Tuesday night that his agency finds it difficult to “push back” against misleading or wrong news reports.

“At CIA we’re often limited in what we can say, given the need to protect classified information. In many cases we can’t set the record straight because doing so could harm national security,” Pompeo told a gathering of the Intelligence and National Security Alliance, a nonpartisan group in support of the intelligence community.

It took a lawsuit to release the information about the theft from CIA vending machines. The agency released a declassified report about the case as part of hundreds of documents obtained through a Freedom of Information Act lawsuit filed in 2015 by BuzzFeed News.

Pilfering from the vending machines began in 2012, and by March 2013, inspectors began looking into the thefts, discovering that the culprits were unplugging a cable linking the machines to a payment system, FreedomPay, letting them obtain snacks at no charge.

“Video footage recovered from the surveillance cameras captured numerous perpetrators engaged in the FreedomPay theft scheme, all of whom were readily identifiable as Agency contract personnel,” the inspectors’ report says.

The vending machine thievery wrapped up neatly. But Reidy still waits for resolution of the seemingly far more significant issues he has raised.

Reidy is more straight arrow than troublemaker. A native of Worcester, Mass., he was educated in Catholic schools, then attended St. Anselm College in New Hampshire and obtained a law degree from the University of San Francisco. Law degree in hand, he dreamed of joining the FBI.

After a stint in the Army, where he worked in a criminal investigations division, Reidy applied for jobs at both the FBI and the CIA. The CIA called more quickly, and Reidy joined in 2003, leaving six months later for a private contractor that dealt in security policy.

Reidy formed his own company in 2006, Form III Defense Solutions, and worked as a subcontractor, piggybacking on contracts won by bigger companies for intelligence collection, tactical targeting guidance and other matters, usually with the CIA.

A resume he gave to McClatchy shows that from 2006 to 2009, Reidy developed an “Iran Study Guide” and worked on “humint” — or human intelligence. Reidy said intelligence community secrecy rules bar him from naming the country where he handled a “complex agency operation,” but he does say he studied some Farsi language. He hasn’t done any classified work since 2012.

Two different issues led Reidy in 2010 to submit a complaint to the CIA’s internal watchdog, the Inspector General’s Office. One issue involved what Reidy alleged was fraud between elements within the CIA and contractors. Another issue involved what he called a “massive” and “catastrophic” intelligence failure due to a bungled foreign operation, according to his 2014 appeal to an office under the director of national intelligence.

Reidy said he sent the Inspector General’s Office 80 emails and 56 documents to back up his complaints.

Legal protections for whistleblowers in the intelligence community grew stronger in 2012, when then-President Barack Obama signed a presidential directive protecting people from various forms of retaliation, including demotions, termination or reassignment. Reidy took heart at the move.

“He was the poster child of the person the system is supposed to work for,” said Kel McClanahan, a Maryland attorney who represented Reidy until 2016.

Despite the Obama directive, experts working in the national security arena say employees still confront obstacles. Employees’ lawyers have no access to classified documents around which a case may rest. Classified matters cannot even be discussed between client and attorney. The CIA sees its Inspector General’s Office as impartial and makes it difficult for employees who hire attorneys, although Reidy did so for years.

Often, CIA employees or contractors find their careers put on hold.

“You will likely find yourself a pariah because nobody likes someone who rocks the boat,” said Bradley P. Moss, a Washington lawyer who handles some national security cases involving whistleblowers.

Employees disgruntled over fraud, abuse or other matters cannot easily look to obtain redress from outside the intelligence community.

“There’s no outside review of whistleblower cases in the intelligence community,” said Kathleen McClellan, deputy director at Expose Facts, a whistleblower advocacy group. “If you’re an employee who sees something egregious, they don’t have to do anything with it. They can flush it down the toilet for all you know.”

As Reidy found out, an internal investigation can drag on without time limit.

“They can go on for years. They can go on for decades,” said Jesselyn Radack, a former Justice Department ethics attorney who also works at Expose Facts.

Reidy has also told his story to staffers with security clearances for the House and Senate intelligence committees, and seen his case bounce between the CIA inspector general and the inspector general for the Directorate of National Intelligence.

Desperate for an outcome, Reidy increasingly warns that the failure of whistleblowing channels may lead disgruntled employees and contractors to go public with secrets, posing a danger to national security.

The CIA and the National Security Agency have been hit with numerous cases of leaks since the ground-shaking case of Edward Snowden, the NSA contractor who in 2013 leaked to the media details of extensive surveillance, including of tens of millions of Americans.

This year, another NSA contractor, Harold T. Martin, was indicted for amassing secret stolen documents and data at his Maryland home over a 20-year period. He awaits trial.

Prosecutors in early June charged another NSA contractor, 25-year-old Reality Winner, with sending a classified report about Russia’s meddling in the 2016 elections to The Intercept, a national security news outlet. She could face 10 years in prison.

For its part, WikiLeaks, the anti-secrecy group, began publishing in March a series of cyber-espionage documents that it claimed were taken from the CIA’s elite hacking unit. Speculation rose that a CIA contractor stole the documents and leaked them.

Seeking to spur action in his case, Reidy last month fired off letters to the chairman and ranking member of the Senate Judiciary Committee, warning that working through the CIA Inspector General’s Office has been a dead end.

“They just delay, delay, and delay and hope the problem goes away,” Reidy said in a June 5 letter to Sen. Charles Grassley, the Judiciary panel’s chairman.

Reidy said his own example bodes poorly for those who want to report fraud or abuse.

“If you are contemplating whistleblowing ... you’re going to sit there and say, ‘If I go through that system, it will not end well for me. I’m going to lose my career and I’m going to be financially devastated,’” Reidy said.