Every week, we pick a new episode of the week. It could be good. It could be bad. It will always be interesting. You can read the archives here. The episode of the week for September 23 through 29 is “Time’s Up for the Gang” the fourth episode of the 13th season of FXX’s It’s Always Sunny in Philadelphia.

The path It’s Always Sunny in Philadelphia has to walk is an extremely narrow one. FXX’s venerable comedy of miscreants and the horrible things they do has to honor the fact that its characters are dirtbags, but it also has to pull back just enough to wink at the audience. “See!” that wink says. “We know these guys are jerks. But they’re funny ones, right?”

That the show has succeeded at this task for 13 seasons — and arguably gotten better at it over those 13 seasons — feels like a minor miracle. Some of that can be ascribed to how it never makes too many episodes in a given season (most seasons of the show have been just 10 episodes long), and some of it can be ascribed to how experienced everyone involved in the show is at performing this delicate balancing act.

But I think almost as much has to be ascribed to the way the world itself has changed around Sunny, and how all involved have proved uniquely well-suited to feeling out those changes, sometimes before they’re even evident. The show debuted in 2005 at the tail end of a wave of comedies that reveled in raunchy “political incorrectness,” but what set it apart was how much it understood that the people hurt by its main characters’ actions often had a point. It was a comedy informed by antihero dramas more than other “best friends who hang out at a bar” shows.

And rarely has that been more evident than in the series’ latest episode, the extremely funny, unexpectedly timely “Time’s Up for the Gang.”

Sending the Sunny gang into sexual harassment training is an almost perfect comedic premise

“Time’s Up for the Gang,” written by Megan Ganz, takes the past year of #MeToo and Time’s Up activism, meant to point out the horrors women face in day-to-day life, and throws it into a blender after the gang from Paddy’s Pub learns they have been placed on a “shitty bar” list, which is reminiscent of the instantly infamous “Shitty Media Men” list. (It’s even formatted similarly.)

They and the staffers of the other bars on the list are made to go to sexual harassment training — it’s not clear by whom — and the bulk of the episode takes place in hotel conference rooms, as the characters struggle to prove that they’re not sexual harassers, as everybody else involved in the training becomes progressively more horrified by them. This is the show’s MO: Put the characters in a place where they can do horrifying things, then contrast them with everybody else, until even scummy folks seem a little better in comparison.

But what’s notable about “Time’s Up” is the way it takes an already threadbare comedic premise — dummies don’t understand that, for instance, looking at a woman’s breasts is harassment and not a “compliment” — and rolls it through the 12 previous seasons of Sunny.

The episode brings up long-running gags (like Charlie’s obsession with the Waitress he’s been effectively stalking all series long) and more obscure references (like the mystery of what exactly happened when Charlie and Dee had sex), and then has the other characters who hear about them, especially the duo leading the seminar, react in abject, slack-jawed horror. As always, the comedy comes from less damaged people reacting to the extremely damaged Paddy’s gang. But it also comes from the show’s well-established history.

I’m not entirely sure the series could have done an episode like this and gotten away with it if it hadn’t been on the air for 13 years. There’s almost a weird poignancy to the way the world has started to change, started to recognize the pain of those who survive sexual harassment and assault, while the Paddy’s gang’s attitudes remain, effectively, those of juvenile 20-somethings who think the most shocking thing you could do is call a woman a bitch and then chortle about it. They are frozen in time, but time keeps moving.

The older Sunny gets, the more it plays off this dynamic too. The characters have revelations about themselves that occur at a glacial pace (it took 12 years of hints and cajoling for Mac to finally admit he was gay), and they’re terrible at expressing their feelings of pain, resentment, and loneliness, which ends up manifesting as sociopathy. It’s great for comedy, and Sunny never loses sight of that. But it’s also been weirdly great for pathos.

After all, somewhere at the core of “Time’s Up for the Gang” is a long series of stories about five people who have badly hurt each other and random other people doomed to enter their orbits. They’re unrepentant, but they’re also, perpetually, too blinkered and too stupid to realize that’s what’s happened. This weird tragedy is what makes them great comedic characters and durable TV characters. But it also requires that tightrope walk I mentioned earlier to be exactly on point. One false step and the whole thing crumbles.

What’s most remarkable to me is that I continue to watch this show, season in and season out, even though I know the gang will never really learn anything substantive about the world at large, and if they learn anything about themselves, it will take ages and ages. I normally have a low tolerance for characters whose self-awareness is so minimal that they end up doomed to repeat themselves over and over — and I certainly struggle to enjoy it over multiple seasons, much less 13 of them.

But as the Paddy’s gang exits its sexual harassment training at episode’s end, having learned nothing but that Dennis was the guy who set the whole thing up as an attempt to scare them into being more thoughtful (he’s not really an altruist; he just worries women are getting too much power), it felt just about right to me.

These characters never learn anything because so many of us never learn anything, blinded to the destruction we sow, unable to see through anybody’s eyes but our own, at least not without really trying to exercise our own empathy. Exaggerate that tendency far enough and you get great comedy. Let it run for 13 seasons and it becomes ever funnier — but much, much sadder too. The secret of Sunny’s continued success is how skillfully it’s leaned into both of those qualities.

It’s Always Sunny in Philadelphia airs Wednesdays at 10 pm Eastern on FXX. Previous seasons are available on Hulu. Previous episodes of this season are available on FX Networks’ streaming platforms.