Late last month, Brad Parscale, Donald Trump’s campaign manager, wrote a tweet knocking Kirsten Gillibrand, the junior senator from New York. She had recently become the first senator to join a call for abolishing the Immigration and Customs Enforcement agency; Parscale pulled up an old copy of her Web site, from a decade ago, in which she called for “stopping illegal immigration.” He wrote, “Looking a bit hypocritical. Change the title to ‘I want open borders and no enforcement.’ ”

On Reddit, in the r/The_Donald forum, Trump fans upvoted Parscale’s tweet to a prime position with the message “Savage campaign manager Brad Parscale BTFO Crazy-Stupid Senator Gillibrand!!” (Trump’s admirers tend to be more forgiving of his own turnabouts, on abortion, assault weapons, cuts to Medicaid, and other examples collected in lists such as the Washington Post’s “President Trump, the King of Flip-Flops.”)

In going after Gillibrand, Trump’s allies paid her a surprise compliment, revealing their wariness that, under the right circumstances, she might pose more of a problem for the President than is generally recognized. For years, Gillibrand has been said to have an eye on the White House. Currently, that would put her somewhere on a list of half a dozen Democratic senators jockeying for attention before the 2020 campaign, including Cory Booker, of New Jersey, Kamala Harris, of California, and, more prominently, Bernie Sanders, of Vermont, and Elizabeth Warren, of Massachusetts.

In a Times story last week, Parscale once more disparaged Gillibrand as a prime example of Democratic “political contortionism,” saying, “Her only core belief is that her positions can be completely reversed to meet the mood of the progressive left.” But writing off Gillibrand as a chameleon underestimates her well-honed alertness to where her voters may be headed, and the emerging conditions that could make her a stronger challenger than she appears to be. As one of her aides once told me, “For her, Option One is light and sunshine, Option Two is cut your nuts off.”

In a 2013 Profile, I concluded that the most important thing to understand about Gillibrand, a feature that is sometimes lost amid the Senate’s bland, decorous goings on, is that she is descended from a family of savvy political operatives. Her grandmother Dorothea (Polly) Noonan was a famous macher in the Albany Democratic machine who once told a reporter that she never touched alcohol or cigarettes, “but I can cuss like a son of a bitch.” At the time, women couldn’t be the face of New York State politics, so Noonan worked behind the scenes, as the president of the Albany Democratic Women’s Club, where the young Gillibrand spent her afternoons. “She was our day care, she was our everything,” Gillibrand told me. Before Mario Cuomo died, in 2015, he said of Noonan, “I’ve never met another woman that approaches Polly and all that Polly was. And I wish I could.” He added, “If Polly liked you, she’d do anything for you. If she didn’t, move from the county.” Gillibrand’s mother was one of a small number of women in her law-school class, and hunted the family’s Thanksgiving turkeys with a gun or a bow and arrow; her father, Douglas Rutnik, was an influential political adviser in New York with ties to both parties.

Gillibrand attended Dartmouth College and the U.C.L.A. Law School, then, in 2006, after several years as a corporate lawyer, at Boies Schiller Flexner, she decided to run for Congress as a Democrat in a solidly Republican upstate district, against a four-term incumbent named John Sweeney. She had no name recognition, and friends and advisers warned her against it, but she recognized that city people were moving upstate. She tied her opponent to George W. Bush and the war in Iraq, and raised huge amounts of money. She advocated for an expansion of Medicare, a proposal that Sweeney derided as “a government-run universal health-care system.” She also, however, adopted conservative positions on immigration and guns (earning an A rating from the National Rifle Association). Then, a few days before the election, a personal scandal derailed Sweeney’s campaign. Gillibrand won by six points.

In the House, she joined the Blue Dog Democrats and took a conservative Democratic line, including embracing efforts to make English the national language. But, in a preview of her later populist stance, she voted against the 2008 bank bailout, over the objections of other members of the New York delegation. A year later she became the youngest member of the U.S. Senate, when Governor David Paterson appointed her to fill Hillary Clinton’s seat after she became Secretary of State. Once Gillibrand represented the whole state, she became a strong supporter of same-sex marriage and a repeal of Don’t Ask, Don’t Tell, and she shed her previous positions on guns and immigration, saying that she needed to speak for a broader swath of constituents. In a competitive Presidential primary, she would face hard questions about those stances. In February, in an appearance on “60 Minutes,” she said she is “ashamed” of her previous positions. “I just think, as I’ve gotten older, I’ve learned more about life, and sometimes you’re wrong,” she said. “And you’ve gotta fix it. And if you’re wrong, just admit it and move on.”

She has also proved to have an apt sense of issues that were not receiving the attention they should. In 2014, more than three years before the #MeToo movement, in a memoir and in interviews, Gillibrand spoke of sexist remarks from male lawmakers, including a member of Congress who told her, “Good thing you’re working out, because you wouldn’t want to get porky!” (Her reply: “Thanks, asshole.”) The next year, on The New Yorker Radio Hour, she broadened the point, recalling subtler forms of sexism that she had encountered as a lawyer: “When a partner said to me, when we’re having this big, congratulatory dinner, after years of work, ‘Don’t you just love Kirsten’s efforts? She’s worked so hard. And don’t you just love her new haircut?’ That felt like a shot in the gut.”

Gillibrand’s zeal can alienate potential backers. When Senator Al Franken was accused of sexual misconduct, she was the first Democratic senator to call on him to resign; to some in the Party, that haste was in error. Despite years of political support from the Clintons, Gillibrand said that President Bill Clinton should have stepped down over his relationship with Monica Lewinsky, a decision that has led some Clinton allies to keep their distance from her in the run-up to 2020.

Most recently, as the Times described, Gillibrand has moved toward the left of the Party, embracing an economic-populist platform, including an endorsement of a federal jobs guarantee, training for those who lose jobs to automation, and a tax on financial transactions in the stock market. (The last of these is surprising for a senator whose constituency includes Wall Street; she has, at times, received more money from Goldman Sachs than anyone else in Congress.) Like Alexandria Ocasio-Cortez, the democratic socialist who won an upset victory last month in New York’s congressional primaries, Gillibrand also now supports Medicare for all, rejecting corporate PAC money, and legalizing marijuana.

Gillibrand is a long shot for the Democratic nomination in 2020. Still, after four years of Trump, voters may well be looking less for an alternative than an antidote to him—his stylistic, professional, and moral opposite. That’s one reason that Republican strategists have told me that they think a female candidate (at the top of the ticket or in a Vice-Presidential slot) will pose the greatest threat to Trump. Warren, Harris, and, presumably, other women who have not yet emerged will be on that list. But the Trump campaign’s recent efforts to undermine Gillibrand are a tell that she has a reason to be there, too.