Publication 523 and the Intelligence Community

I sold a primary residence in May 2023 after living there for 5 years. I made less than 500,000 off the sale, filed taxes jointly with my wife, and thus did not pay capital gains tax. 

 

After I sold that home, I bought another home (my new primary home) in June 2023, where I live in it full time with my wife. 

 

I plan to sell this primary home after living it in for 1 year, but before reaching the two-year residence requirement, so that I can buy another primary home in another state.

 

I am a civilian member of the Intelligence Community, as outlined in IRS Publication 523, and I am moving to a new duty station for work (greater than 50 miles away). 

 

Assuming capital gains are less than $500,000, do I qualify for a capital gains exemption, given that I sold a primary home in 2023, bought a new home the same year, and plan to sell that second primary home after living in it for 1 year (but less than 2 years) ?

 

Again, this move will be to another intelligence community duty station.

 

Any help is appreciated!