1. A system to handle requests to execute tasks on an on-demand code execution system, the system comprising: a non-transitory data store configured to store an execution record of a task, wherein the task is associated with code executable to implement functionality corresponding to the task on the on-demand code execution system, wherein execution of the task is dependent on a data resource external to the on-demand code execution system and on the code associated with the task, and wherein the execution record indicates, for a prior execution of the task, a state of the external data resource during the prior execution and a state of the code during the prior execution; and one or more processors configured with computer-executable instructions to: obtain a request to execute the task; transmit a request to an auxiliary service to obtain a current state of the data resource external to the on-demand code execution system; conduct a comparison of the current state of the data resource and the state of the external data resource during the prior execution; obtain a current state of the code associated with the task; conduct a comparison the current state of the code and the state of the code during the prior execution; determine, as a result of the comparisons, that a state of at least one of the data resource or the code has changed since the prior execution; and in response to determining that the state of at least one of the data resource or the code has changed since the prior execution: generate an execution environment for the task on the on-demand code execution system; provision the execution environment with the code; and execute the code within the execution environment.