Skip to content

fix(inference): handle terminal failure statuses and bound polling in WaveSpeed provider - #5422

Open
viliamgonda wants to merge 2 commits into
huggingface:mainfrom
viliamgonda:fix/wavespeed-failure-statuses-and-polling-timeout
Open

viliamgonda wants to merge 2 commits into
huggingface:mainfrom
viliamgonda:fix/wavespeed-failure-statuses-and-polling-timeout

Conversation

@viliamgonda

@viliamgonda viliamgonda commented Nov 22, 2026 •

Copy link
Copy Markdown

WaveSpeed documents failed, cancelled, timeout, and deleted as terminal task statuses. Previously, only failed was handled as a failure condition, while cancelled, timeout, and deleted raised ValueError: Unknown status: <status>. When failed returned with an empty error message, the exception message was left with a trailing colon (WaveSpeed AI task failed: ). Furthermore, the polling loop ran indefinitely (while True) if a task remained in processing or created.

  • Treat failed, cancelled, timeout, and deleted as terminal failures and format error messages cleanly with an optional error suffix.
  • Bound polling iterations using _MAX_POLL_ATTEMPTS (7200 attempts at 0.5s interval, ~1 hour) before timing out.
  • Add test coverage for terminal failure statuses, success result retrieval, and polling timeout in tests/test_inference_providers.py.

Closes #5421


Note

Low Risk
Localized WaveSpeed provider error-handling and polling limits with new unit tests; behavior change is failing fast instead of hanging or mis-reporting status.

Overview
The WaveSpeed inference provider now treats failed, cancelled, timeout, and deleted as terminal outcomes instead of raising “unknown status” for the latter three. Failure ValueError messages include the status name and only append : {error} when the API returns a non-empty error (fixing the stray trailing colon on empty errors).

Result polling is no longer unbounded: a _MAX_POLL_ATTEMPTS cap (~1 hour at 0.5s) replaces while True, with an explicit timeout ValueError when the job stays in processing / created.

Tests cover terminal failure messages (with/without error text), the happy path, and polling timeout.

Reviewed by Cursor Bugbot for commit bfbf684. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.90%. Comparing base (1daa48b) to head (bfbf684).
⚠️ Report is 894 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5422      +/-   ##
==========================================
+ Coverage   75.00%   77.90%   +2.90%     
==========================================
  Files         145      178      +33     
  Lines       13978    25523   +11545     
==========================================
+ Hits        10484    19884    +9400     
- Misses       3494     5639    +2145     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bot-ci-comment

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

This branch has not been deployed

No deployments
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.

WaveSpeed provider: "cancelled"/"timeout" statuses raise "Unknown status", and result polling never times out

2 participants