The U.S. intelligence services believe that Russia hacked the U.S. to sway the 2016 election.
And China has been hacking the U.S. for decades.
And there's lots of 12-year-old pre-teens in Eastern Europe who like the challenge of successfully hacking the Pentagon and the Defense Department.
The primary problem is not how to track down and punish foreign hackers, the problem is that we are hackable in the first place! America apparently lags way behind in government cyber security and needs to update its technology security. Now.
And America also does need to respond to government hacking by foreign actors. If Russia or China hacks our government then our government should hack them back - we could hack their electrical grid and make Moscow or Beijing go dark for a day. That'll send a strong message. A message of: don't mess with America! And, if the U.S. government doesn't have the ability to hack back, then they can hire some 12-year-old kids who do.
The U.S. also does need to better deal with domestic hackers. I suggest we make government hacking by U.S. residents a crime of treason, punishable by an automatic death penalty. An exception would be made for successful underage domestic hackers, who would be given a $200,000-a-year part time job at a major U.S. tech company. Plus benefits. And they can work at home.