We have an edge case that existing unit tests don't cover: starting a single task which consumes every reported CPU. The problem is that the executor overcommits by 0.1 CPUs, so when we go to set the CPU limit, on say a 12 core machine, we set it to 12.1/12 * 10000 CPU cycles, which results in an invalid number of cycles (10,083, but the max is 10,000).
We were bounds-checking the minimum (1 cycle) but not the maximum, as the function did not expect the user to request more CPUs than available.
We'll fix this by checking the max bound. So if, for example, 12.1 CPUs are requested, re set the limit to 10000 CPU cycles, no more.