How to fix damaged wires in receptacle box in new installation?
I don't think that leaving a 4" tail in a box instead of a 6" is the worst code offense you can commit. The reason it is in the code is to match up with the NESC (National Electric Safety Code). This allows while doing maintenance on the device to pull it clear of interference and perform work on it safely. 

You could do what Jim Stewart suggested, just make sure you have the right color code, you attached a pigtail to it, or you could check to see what the AHJ has to say about it and let him make the final decision on whether to allow it or extend it.