Currently the job status is retrieved using the Jenkins API endpoint lastBuild/api/json. However, the job might not be the last built - other job may of been started in the meantime (this is especially true for long running jobs). It would be most robust if the job number/id is obtained when the job has started and then that's used to determine the job status.