Swing-leg retraction in walking is the slowing or reversal of the forward rotation of the swing leg at the end of the swing phase prior to ground contact. For retraction, a hip torque is often applied to the swing leg at about the same time as stance-leg push-off. Due to mechanical coupling, the push-off force affects leg swing, and hip torque affects the stance-leg extension. This coupling makes the energetic costs of retraction and push-off depend on their relative timing. Here, we find the energy-optimal relative timing of these actions. We first use a simplified walking model with non-regenerative actuators, a work-based energetic-cost, and impulsive actuations. Depending on whether the late-swing hip torque is retracting or extending (pushing the leg forward), we find that the optimum is obtained by applying the impulsive hip torque either following or prior to the impulsive push-off force, respectively. These trends extend to other bipedal models and to aperiodic gaits, and are independent of step lengths and walking speeds. In one simulation, the cost of a walking step is increased by 17.6% if retraction torque comes before push-off. To consider non-impulsive actuation and the cost of force production, we add a force-squared (F2) term to the work cost. We show that this cost promotes simultaneous push-off force and retracting torque, but does not change the result that any extending torque should come prior to push-off. A high-fidelity optimization of the Cornell Ranger robot is consistent with the swing-retraction trends from the models above.