[CI] Make CI less flaky and stop 6h hung jobs (#4830)
* [CI] Make CI less flaky and stop 6h hung jobs
Follow-up to an investigation of the recent CI flakiness. All the failures
themselves come from a hub-ci incident (plain-LFS uploads return 403
AccessDenied on s3:PutObject), which is being handled by the infra team. This
commit fixes how our CI *reacts* to such an incident.
- `_upload_large_folder`: cap consecutive errors instead of retrying forever.
A permanent error made the worker loop spin until GitHub's 6h job timeout
(136k retries, 60MB of logs, thousands of requests/min at the Hub).
- Add `timeout-minutes: 30` and a `concurrency` group to `python-tests.yml`,
and stop triggering the whole suite on the `assigned` PR event.
- Drop the `lfs` matrix entry: `TestHfLargefiles` is `@pytest.mark.skip`ped, so
the job selected 1 test and skipped it (green but empty).
- Speed up `TestValidateUploadLimits`: 100k `MagicMock`s -> plain objects
(85s -> 1s).
- De-flake `test_commit_to_repo_in_background` (wall-clock assertion) and
`test_list_private_models` (shared `__DUMMY_HUB_USER__` recency page).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Apply suggestion from @Wauplin
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>