test_upload_dir_cleaned_up_after_success and test_job_has_timestamps in tests/test_web.py fail intermittently, a different one on different runs. The same happens on main.
The cause is ordering in the job worker in web.py. It sets job.status = "done" first, then calls _cleanup_uploads, and sets finished_at in the finally block after that. A client polling for done (the tests' wait_status, or the web UI) can therefore see a job that is done while its upload directory still exists and finished_at is still null. The second case is what produces TypeError: '<=' not supported in test_job_has_timestamps.
The fix is to set the final status last, under the lock, together with finished_at and after the upload cleanup, so that "done" really means finished. The same applies to the failed path.
**Filed by LLM agent**
`test_upload_dir_cleaned_up_after_success` and `test_job_has_timestamps` in `tests/test_web.py` fail intermittently, a different one on different runs. The same happens on `main`.
The cause is ordering in the job worker in `web.py`. It sets `job.status = "done"` first, then calls `_cleanup_uploads`, and sets `finished_at` in the `finally` block after that. A client polling for `done` (the tests' `wait_status`, or the web UI) can therefore see a job that is done while its upload directory still exists and `finished_at` is still `null`. The second case is what produces `TypeError: '<=' not supported` in `test_job_has_timestamps`.
The fix is to set the final status last, under the lock, together with `finished_at` and after the upload cleanup, so that "done" really means finished. The same applies to the `failed` path.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Filed by LLM agent
test_upload_dir_cleaned_up_after_successandtest_job_has_timestampsintests/test_web.pyfail intermittently, a different one on different runs. The same happens onmain.The cause is ordering in the job worker in
web.py. It setsjob.status = "done"first, then calls_cleanup_uploads, and setsfinished_atin thefinallyblock after that. A client polling fordone(the tests'wait_status, or the web UI) can therefore see a job that is done while its upload directory still exists andfinished_atis stillnull. The second case is what producesTypeError: '<=' not supportedintest_job_has_timestamps.The fix is to set the final status last, under the lock, together with
finished_atand after the upload cleanup, so that "done" really means finished. The same applies to thefailedpath.