Stocks were jumping early Thursday after China said both sides in the US-China trade war had agreed to roll back tariffs if their talks progress. But an afternoon report from Reuters citing fierce opposition within the White House to the agreement undercut the enthusiasm, and the majority of the market’s gains evaporated. Still, the S&P 500 managed to set a record for the second time this week. Encouraging reports on the economy and corporate profits have helped drive stocks back to record heights in recent weeks. The US job market remains strong, and the Federal Reserve has cut interest rates three times since the summer to bolster the economy. Earnings for big companies, meanwhile, weren’t as bad in the summer as Wall Street had feared. That leaves the US trade war as the wild card for the global economy, and markets are trading on every whiff of movement about it as a result. ‘‘It’s not that trade is more important to the market than economic growth or than the Fed,’’ said Steve Chiavarone, equity strategist at Federated Investors. ‘‘It’s that the market has already priced in that picture’’ of a still solid economy and easier interest rates.