The most common distinction between comedy and tragedy is that the former has a happy ending, while the latter does not. All’s well that ends well, but not every happy ending is happy. It is, I submit, a question of perspective. A happy ending is always happy when seen from the point of view of those for whom the ending is meant to be happy. Which is a tautology. How can it be otherwise? A comedy has a happy ending because the plot is untied and resolved in a manner which favours the protagonist. But the point of view of the protagonist is not the only one, or at least it shouldn’t.
Homer’s Odyssey and Virgil’s Aeneid are both comedies at heart, despite the killing and the dying. They are comedies because they both end happily, and the conflict does not implode in death through suffering, hard choices and despair, as it does in tragedies focused on Antigone, Medea or Oedipus. There might be tragic strands in a comedy, just like there might be comedy effect in some tragedies.
I once had an idea of writing an imaginary anti-Odyssey in which the wheels of the epic plot keep getting stuck in the mud of kakos telos, a bad ending, and never manage to move on. One bad ending leads to another through a series of imagined plot follow-ups, a mise-en-abîme of visions and dreams in the minds of the characters responsible for causing the (imagined) plot(s) to end badly. It would be something like this: Ulysses never gets home to Penelope, obviously. The fact that he does in the Odyssey makes it a happy ending, but only for him, Penelope and Telemachus, not for the suitors, enemies and rejected lovers on the way.
So Ulysses doesn’t get home. Instead, he dies on the way. Lots of opportunities to kill the plot halfway through. Calypso exhausts him through wild sex. Polyphemus devours him. He dies a pig in Circe’s pigsty. The possibilities are endless. But to keep the plot flowing, albeit in rigor mortis, all of these characters, Calypso, Polyphemus, Circe, etc, are haunted by what could have happened, which is effectively the known plot of the epic poem. The failed plots develop in their dreams as though they could have happened. So Polyphemus, during his post-Ulyssean siesta, dreams of what Ulysses could have achieved had he managed to escape the Cyclops. And so on so forth. The only way Polyphemus could enjoy a happy ending to his own version of the Odyssey was for Ulysses to be deprived of his own.