When your program tells you to is a good starting point.
Seriously though, it really all depends on what your goals are.
If you go the route of acquiring gym knowledge the hard way (like attempting to figure things out on your own which is an admirable pursuit in and of itself sometimes), there are a lot of different ways to accommodate this. A simple way is define a rep range you want to work in. So let’s say based on your goals you want to work 8-12 reps. Because of your goals, time constraints, or whatever the hell else is going on, you’ve decided that 4 sets on an exercise is what you need. Right now you can bench 135 for 4 sets of 10 (just as an example). Can you do 4 sets of 11? 4 sets of 12? So next time you go in to bench, do 3 sets of 10 and on your 4th set, shoot for extra reps. Don’t go to failure, but only leave one or two in the tank. When you’ve got about enough extra reps in the last set to take and add 1 to each of the other sets, bump up the reps for your set. Let’s say you do 3x10 and 1 x 13. That’s pretty close to 4x11. So you move the reps up to 4x11 as a minimum. You keep doing that until you get to the top of your rep range, and then move the weight up 10-20 lbs with a plan to go to the low end of your rep range next session. So now your working weight is 145 and your base plan is 4x8. You’ll still try to get an extra couple of reps on the last set. Do not take extra reps on earlier sets. You want to make sure you always hit the base case on sets and reps. You will not bench less than 4x8 at the new weight.
Go up in small intervals so you can continue to progress your lifts for longer. Depending on your strength level and how long you’ve been training, you’ll be able to make a lot of gains for a while. Track your rest periods between sets as well. If you’re having trouble closing the sets at the new weight, it gives you another variable to tweak at first by giving longer rest periods and then shortening them to 1-min or less.
This is how I do things for assistance work. I’m not saying it’s optimal, but it works for me.