You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: skip backoff after the final model download attempt - #856
When every model download fails, the default three-attempt loop sleeps for 3, 9 and 27 seconds. The final 27-second sleep occurs with zero retries left and only delays the eventual ValueError.
Back off only when another attempt remains. This keeps the same download attempts and fallback behavior, with sleeps of 3 and 9 seconds between the default three attempts. A single failed attempt no longer sleeps before raising.
Four new regression cases fail before the fix and pass afterward. They cover one/three attempts, with and without URL fallback, and assert both attempt counts and sleep calls.
uv run --no-default-groups --group test pytest tests/test_download_retries.py tests/test_model_management.py tests/test_common.py -q: 15 passed.
Ruff passes for the new test file; formatting passes for both changed files.
Ruff reports seven existing findings in model_management.py. The unchanged file from HEAD produces the same seven findings, so this PR leaves that cleanup out of scope.
Downloads and sleeps are mocked in the regression tests; no model weights or external services are required.
AI assistance: OpenAI Codex generated the change and regression tests. Validation was run locally.
No actionable comments were generated in the recent review.
Walkthrough
download_model now logs and sleeps for a retry only when another attempt remains. New parametrized tests check failed downloads with one or three retries, with and without URL fallback. They verify download and fallback calls, sleep delays, and the final ValueError.
Failed model downloads no longer wait after the last attempt, so the final error appears sooner. Retry count, fallback and error behavior stay the same. The change is small, covered by regression tests and easy to revert.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title states the main change: the download retry logic no longer sleeps after the final model download attempt. It matches the raw summary, the PR description, and the objectives, and it follows t…
Description check
The description explains the problem: the default three-attempt loop sleeps 27 seconds after the last attempt. It states the fix, which backs off only when another attempt remains. It also lists the v…
Linked Issues check
Issue #855 requires ModelManagement.download_model() to sleep only when another retry remains. The whole-PR diff against the merge base changes one line in fastembed/common/model_management.py: th…
Out of Scope Changes check
The whole-PR diff against the merge base changes only the retry sleep condition in ModelManagement.download_model. The summary reports that tests/test_model_management.py adds parametrized regress…
Full details: Title check
Explanation
The title states the main change: the download retry logic no longer sleeps after the final model download attempt. It matches the raw summary, the PR description, and the objectives, and it follows the conventional fix: prefix format. The title is 56 characters, which is concise.
Full details: Description check
Explanation
The description explains the problem: the default three-attempt loop sleeps 27 seconds after the last attempt. It states the fix, which backs off only when another attempt remains. It also lists the validation steps and links issue #855. It relates directly to the changeset in model_management.py and the new regression tests.
Full details: Linked Issues check
Explanation
Issue #855 requires ModelManagement.download_model() to sleep only when another retry remains. The whole-PR diff against the merge base changes one line in fastembed/common/model_management.py: the retry branch else: becomes elif retries > 0:. The final failed attempt therefore skips the logging and sleep. The previous assessment verified that the regression test covers retries=1 and retries=3, with and without URL fallback, and expects sleep calls of [] or [3.0, 9.0]. The local_files_only branch is unchanged, so offline behavior and the final ValueError path are preserved. The sleep values and attempt count are not changed by this diff. Limitation: this review read only the one-line hunk and did not re-read the surrounding loop to confirm the decrement order. The PR description names tests/test_download_retries.py, but the head file list does not contain it. The regression tests appear in tests/test_model_management.py per the summary. This naming mismatch does not affect the coding requirement.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base changes only the retry sleep condition in ModelManagement.download_model. The summary reports that tests/test_model_management.py adds parametrized regression coverage for the same retry and sleep behavior. Both changes connect directly to Issue #855. No unrelated production or test changes appear. The Ruff findings in model_management.py are reported as pre-existing and are not part of this diff.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: ff746534-305b-49b2-8529-f08f07ce8cf6
Commits
Reviewing files that changed from the base of the PR and between 88a68dc and 61ebb72.
Files selected for processing: 1
tests/test_model_management.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When every model download fails, the default three-attempt loop sleeps for 3, 9 and 27 seconds. The final 27-second sleep occurs with zero retries left and only delays the eventual
ValueError.Back off only when another attempt remains. This keeps the same download attempts and fallback behavior, with sleeps of 3 and 9 seconds between the default three attempts. A single failed attempt no longer sleeps before raising.
Fixes #855
Validation:
uv run --no-default-groups --group test pytest tests/test_download_retries.py tests/test_model_management.py tests/test_common.py -q: 15 passed.model_management.py. The unchanged file from HEAD produces the same seven findings, so this PR leaves that cleanup out of scope.AI assistance: OpenAI Codex generated the change and regression tests. Validation was run locally.