The frame decides it. If the frame is sound and square and the hardware still works, a failing window is often a glass repair, which costs a fraction of a full replacement.
If the frame has warped, corroded or moved, new glass in an old frame is money wasted. That is a replacement, and it is the honest answer even though it costs more.
The two we see most are impact damage, where something hit the pane, and seal failure, where a double pane unit has fogged. The first is often a repair. The second is always a glass replacement, because the seal is not serviceable.