It really depends upon the price, the buyer, the buyer's insurance company and the lender.
Some banks require up to 5 years of remaining roof life if the buyer is in a first-time buyer program. This is because the bank is lending more than 80% of the sale price (in some cases, its as high as 97%). If the buyer defaults, the bank is stuck with the roof.
VA loans have a hard requirement for 2 years of remaining life. In my experience, they are unwavering on this requirement. However, keep in mind that my experience with VA loans is from 20 years ago when I used to flip houses (before they made TV shows about it and blew up the flip market
). The VA could have loosened the requirement on this over the years, but I doubt it.
Some insurance companies will not insure a house with less than 2 years remaining. At least, this was the case when I bought our previous house about 12 years ago. I bought it knowing that it was somewhat of a fixer-upper and that the roof was old. However, once I had a letter from my insurance company saying that the house was uninsurable because of the roof, I was able to negotiate a 50% split with the seller.
Aside from a VA loan, it really comes down to price. If you agreed to a price on the lower end of comps, then you have some leverage to hold firm. If you agreed to a price on the high end of the comps, then expect the buyer to come looking for a new roof.
If they do come looking for a roof... in my opinion, you are better off giving them a credit at closing. If you do it yourself, you are responsible for unexpected costs. If you give them a credit, you are off the hook forever.
If they do come looking for a roof, don't be surprised and be firm but reasonable. Keep in mind that most buyers are emotionally involved at this point. Meaning, most will not blow up a deal if things remain relatively fair... even if it means that they take a small hit.
None of this matters if the inspector does not know what he/she is looking at. He/she might gloss over the roof if it "looks" good.
Just my two cents, based upon my experience over the years. Good luck!