Patrons sipped cocktails on the patio of the Dupont Circle restaurant from tables just a few feet apart. None appeared to have masks nearby. Servers and busboys wove through tight spaces, some with their mouths covered, but not their noses.

D.C. city inspector Jason Peru furrowed his brow as he approached.

Little had changed since he visited Residents Cafe and Bar in June, bringing with him guidance on reopening safely and a warning that the tables were too close together. Now it was time to turn up the heat.

Two months since the nation’s capital allowed restaurants to seat customers indoors again, coronavirus cases are again climbing, and more people are dining out while likely infectious.

While contact tracing to determine the source of exposure has been difficult, the city has identified restaurants as a place the virus could be spreading.

In a sample of 100 new coronavirus cases reviewed by D.C. Health, a quarter of recently infected people ate inside a restaurant while they were likely contagious, D.C. Health Director LaQuandra Nesbitt disclosed Wednesday.

Government officials in the District and beyond are navigating tough waters as they try to revitalize a dining industry that makes their cities vibrant and buoys struggling local budgets, while also trying to stop a resurgence of infections.

The novel coronavirus is spread through respiratory droplets when people talk and sneeze. Restaurants and other indoor spaces that draw maskless people for long periods of time with limited ventilation are prime vectors, health experts say.

An analysis by the Center for American Progress, a think tank, found states that waited to reopen dining and imposed mask mandates earlier were the best at containing transmissions.

“When you go out dining, you are in a room full of strangers, and these are not repeat interactions with the same people, so you risk spreading the virus,” said Emily Gee, who led the research. “We know these are risky activities, and we also shouldn’t let the lack of contact tracing hamper us from making smart decisions.”

New York City has not reopened indoor dining even as it entered its final phase of reopening. Chicago permits it at 25 percent capacity. Baltimore revived an indoor dining ban as cases rose in July, though it has since eased restrictions.

D.C. Mayor Muriel E. Bowser (D) allowed indoor dining at half capacity among the newly permitted activities when the city shifted to the second phase of its reopening in late June, bringing relief to some residents tired of being cooped up at home and anxiety to others. Pedestrians with masks dangling under their chins have clogged narrow 14th Street sidewalks and barefaced patrons have packed into long lines to enter bars on the U Street nightlife strip.

Daily cases have nearly doubled in the second reopening phase — with people under 40 making up a growing share — but city officials have not identified which permitted activities are driving the new infections.

The District has declined repeated requests to release its contact tracing data. Maryland late last month disclosed that 12 percent of infected people interviewed worked in restaurants or the food industry, and 23 percent had visited restaurants.

Critics have urged the mayor to crack down on restaurants, given the known risks of transmission. She said her administration is instead responding with an ongoing education and enforcement blitz by the D.C. Alcoholic Beverage Regulation Administration, which normally enforces underage drinking laws and license compliance.

Liquor regulators say most bars and restaurants are complying with the mayor’s rules, such as maintaining six feet of distance between tables, prohibiting people from standing and drinking, and keeping music low so patrons don’t need to talk loudly and spread more droplets.

As of last week, 13 businesses had been fined $1,000. Inspectors let 47 establishments off with warnings.

The District has moved to suspend two liquor licenses — the greatest penalty — against Lyve at U Street and Elevate in Northeast Washington. Both are accused of operating like nightclubs with live entertainment, loud music and people partying without masks — all conditions that can exacerbate the spread of the virus.

City officials say those cases are not the norm: Most businesses just need reminders. But sometimes that’s not enough.

Holding a walkie-talkie in one hand and an ABRA badge dangling from his neck, Peru didn’t need a measuring tape to spot the violations at Residents Cafe and Bar, where customers can order smashed avocado toast for brunch and seared octopus for dinner. There was no employee or manager trained on the regulations, including covid-19 restrictions, on duty — another violation.

Maybe the customers were moving the chairs closer themselves, a maitre d’ suggested. Peru shook his head and gestured to three parties all seated on the same bench along a row of planters.

“That’s like one big group, and they are not together, right?” Peru asked, prompting a nod.

The investigator then pointed to the middle of the patio to show another common problem: The tables might be six feet apart, but if the people are not, then the virus could be spreading.

“This guy sitting there now, is he six feet away from the guy behind him?” asked Peru, who has been with the agency for seven years.

A fellow investigator handed over a $1,000 citation to the ­maitre d’.

“What I’m asking you is please, please figure out the best way to get this right so there’s no further action,” Peru said.

In an email to The Washington Post, Residents managers said they’ve been trying their best at great expense to expand their outdoor patio in compliance with social distancing rules.

“There are some things outside of our direct control, like years of specific customer behavior and whether customers decide to follow the policies we implement,” the restaurant said in an unsigned statement. “Is it possible that our staff may miss an opportunity to implement a new policy? Yes. Will we immediately communicate and enforce the policy with the customer? Yes. Will we hold our staff accountable? Absolutely and every time.”

When The Post joined investigators on a Friday night, most places easily passed their inspections.

Stoney’s in Logan Circle seated a 12-person party across two tables, with one customer joking he didn’t want to see his other friends anyway. A welcome sign outside The Pub and the People in Bloomingdale joked, “Don’t be a Karen” in a reminder to wear masks. Uproar, a gay bar in Shaw, moved tables to its rooftops to prevent the usual crowd of people standing and drinking close together.

Andrew Kline, an attorney and lobbyist who works with the Restaurant Association of Metropolitan Washington, says establishments know they are in danger of losing business if city officials lose faith in their ability to operate safely.

“If we give a reason for there to be a rollback, then there will be a rollback,” Kline said. “Most businesses recognize it’s very important to not only have a safe environment, but project that you have a safe environment so people feel comfortable going out.”

Investigators are encouraged to use their discretion in deploying sanctions, Peru said, and most are let off with a verbal or written warning.

That was the case when Peru made his second stop at the popular outdoor beer garden Dacha, in the Shaw neighborhood.

During his first visit, in late May, he suggested laying out the wooden bench tables in a zigzag formation to leave no question they were distanced. Instead, the bar unmounted the tables and placed blue tape to block off the end of the benches as a way to maintain distance. And they continued to seat customers near the bar in violation of a city prohibition on bar seating because of the proximity to bartenders.

Customers paused drinking from beer boots under the visage of a giant Elizabeth Taylor mural to gawk as Peru extended a tape measure to show how people were still seated too closely together.

“You made an effort to separate them, so I appreciate the effort,” Peru told a manager. “But it’s still not six feet.”

He left them with a written warning for failure to enforce social distancing, as investigators had done for the Dacha location in Navy Yard earlier in the month.

Courtney Flantzer, a spokeswoman for Dacha, said inspectors returned Tuesday at the invitation of the beer garden owners to verify the changes to their seating complied with city rules. Inspectors found no violations. She said it’s been challenging to adjust to a pandemic when the beer gardens are normally bustling environments where people hang out for entire summer afternoons in big groups.

“We want to be the safest possible environment so people can feel free to relax and have a few beers,” she said.

Peru said he saw the exchange at Dacha as more of an opportunity to inform than to punish.

“There are a lot of good actors out there,” Peru said. “Tonight was typical. Education, education, education. We’ve been doing that since the closure, and we still want to do that now.”

Michael Brice-Saddler, Julie Zauzmer and Fritz Hahn contributed to this report.