Star Wars: Episode IX -  The Rise of Skywalker introduced a number of new journeys and character motivations. One of the most unexpected - and arguably least earned - twists was the revelation that General Hux was actually working as a spy for the Resistance against the First Order. This sudden about-turn in storytelling was introduced as a mystery and then rather jarringly solved with the quick revelation that it was Hux.

Aside from the lack of emotional buildup, this idea may have felt familiar to fans because it was a less nuanced version of a previous Star Wars Rebels arc. In Rebels, the Imperial character of Agent Kallus already underwent the exact same change of allegiance, though with more fleshed out reasoning.

RELATED: Star Wars: The Empire's Greatest Weapon Against the Rebels Was... Fake News

From his first appearance in Star Wars: Episode VII - The Force Awakens, Hux was painted as a pouty, angry, fanatical First Order zealot. His loyalties lay more with the pursuit of power and control than with anything else. Though he was constantly questioning his superior, Kylo Ren, it was always from a place of heated rivalry and a desire to advance further in the ranks of the First Order. He was an animated, if somewhat one-dimensional, villain.

Then, in The Rise of Skywalker, audiences were presented with an intriguing new mystery: someone in the First Order was providing the Resistance with classified information, but their identity was unknown. Meanwhile, in the wake of Supreme Leader Snoke's death and Kylo Ren's ascension to leader, Hux was relegated to being one of many generals, rather than a right-hand man. Not much time was spent digging into the identity of the Resistance's spy before it was revealed that Hux was the one who had been feeding them information all along, making him a late-in-the-game First Order traitor. His motivation, he explained, was wanting to bring down Kylo Ren and see his nemesis fail.

General Hux in the Star Wars sequel trilogy

RELATED: Star Wars: The Rise of Skywalker Graphic Novel Gives the Blockbuster Finale a New Look

But his storyline was not the first to follow this route. It was very similar to that of Agent Kallus in Rebels, who not only had an extremely similar haircut to Hux, but was also a dedicated Imperial loyalist who acted as a double agent for the Rebel cells. Kallus began his time in Rebels as an ongoing enemy of the Ghost crew and the entire Rebellion. A high-ranking Imperial Agent, he took his job very seriously and was dedicated to tracking down and eliminating the heroes. But in Season 2, Episode 17, "The Honorable Ones," the seeds of Kallus' growth were firmly planted and watered when he became stranded on an ice moon of Geonosis with Ghost member Zeb following a failed Imperial attack on the Rebels.

While the two began by holding on to their mutual hatred, they soon learned to work together and even had some deep conversations, in which Zeb explained the emotional and logical flaws in the Empire. When Kallus saw how much Zeb's friends risked to save him at the episode's end, he began to rethink his old allegiances, eventually leading him to become disillusioned with the Empire and turn spy for the Rebels. By the time he took up the storied spy mantle of Fulcrum, it was a natural and earned change of allegiance.

Though Hux's transformation into a traitor yielded similar results, it didn't feel anywhere near as natural nor did it come out of nowhere to Rebels watchers. The main difference that made Kallus’ story arc work better than Hux’s was that Kallus actually had a change of heart when shown kindness. He also lost faith in the Empire when he realized they weren’t really about peace and galactic order after all. On the other hand, Hux's turn was not only out of left field, but he didn't even undergo much, if any, character development onscreen. He was just initiating an act of late-blooming, petty revenge against his rival, Kylo Ren. Rebels enacted this twist first, and pulled it off in a much more satisfying way.

KEEP READING: Star Wars Rebels STILL Delivers the Franchise's Most Heartbreaking Death