Skip to content

feat: enhance error handling for upload retries with new status parsing - #465

Open
egalvis27 wants to merge 1 commit into
mainfrom
fix/retry-upload-server-errors
Open

feat: enhance error handling for upload retries with new status parsing#465
egalvis27 wants to merge 1 commit into
mainfrom
fix/retry-upload-server-errors

Conversation

@egalvis27

@egalvis27 egalvis27 commented Sep 10, 2026

Copy link
Copy Markdown

What is Changed / Added


  • Improved upload error handling for server-side failures.
  • HTTP 5xx upload errors are now identified as retryable instead of being treated as unknown errors.
  • Prevents temporary local files from being deleted after a temporary server upload failure.

Why


Some upload server errors were returned without an HTTP status property, causing them to be classified as non-retryable. This could delete the staged local file even when the failure was temporary.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of upload errors when HTTP status codes appear in error messages.
    • Server errors now correctly trigger retries, while rate-limit errors receive the default delay.
    • Non-retryable client errors are correctly recognized, and invalid status codes are ignored.
    • Retry attempts now stop promptly when cancellation is requested.

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: da9bef98-ad0d-4493-900d-d88c82a1bdca

📥 Commits

Reviewing files that changed from the base of the PR and between c89fd7e and d22f71f.

📒 Files selected for processing (2)
  • src/backend/common/rate-limit/transient-error-handler.test.ts
  • src/backend/common/rate-limit/transient-error-handler.ts

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The upload error handler now extracts supported HTTP statuses from upload error messages. Tests cover classification, retry decisions, successful retries, and abort handling.

Changes

Upload error classification

Layer / File(s) Summary
Status extraction and classification
src/backend/common/rate-limit/transient-error-handler.ts
The handler reads numeric status properties or supported upload error messages. It classifies status 429 as rate limited and statuses 500 or higher as internal server errors.
Classification and retry validation
src/backend/common/rate-limit/transient-error-handler.test.ts
Tests cover status precedence, unsupported status formats, retry decisions, successful retries, and abort handling.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Merge Risk: ⚪ Minimal · up to d22f7

This change improves retry handling so that server-side upload failures reported only through error message text (not an explicit status code) are now correctly retried instead of being treated as permanent failures, which should reduce cases where temporary files are prematurely deleted after transient server errors. The change is small, covered by new tests, and the parsing logic was verified to safely reject unrelated numeric patterns and to be unreachable by malformed inputs in production. No blocking risk was found.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: improved upload retry error handling through status parsing.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/retry-upload-server-errors

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/backend/common/rate-limit/transient-error-handler.test.ts

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

src/backend/common/rate-limit/transient-error-handler.ts

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant