Skip to content

fix(xai-video): preserve timeout and transport error types - #57224

Open
EndeavorYen wants to merge 1 commit into
NousResearch:mainfrom
EndeavorYen:upstream-pr/xai-video-error-classification
Open

fix(xai-video): preserve timeout and transport error types#57224
EndeavorYen wants to merge 1 commit into
NousResearch:mainfrom
EndeavorYen:upstream-pr/xai-video-error-classification

Conversation

@EndeavorYen

Copy link
Copy Markdown
Contributor

Summary

  • preserve timeout failures from the xAI video wrapper as error_type="timeout"
  • preserve xAI video transport failures as error_type="connection_error"
  • keep unrelated wrapper failures classified as api_error
  • add focused regression coverage for httpx.ReadTimeout and httpx.ConnectError

Problem

The synchronous xAI video wrapper catches exceptions raised while running the async generation/edit/extend coroutine. Today those wrapper-level exceptions are collapsed into api_error, so callers cannot distinguish a transient timeout or connection failure from a provider API response error.

That loses useful recovery signal for retry/fallback guidance and makes diagnostics less precise when the provider path fails before a structured xAI response is available.

Fix

Add a small wrapper exception classifier:

  • TimeoutError and httpx.TimeoutException map to timeout
  • httpx.TransportError maps to connection_error
  • everything else remains api_error

The user-facing error string now includes the exception class name, which makes empty-message timeout exceptions diagnosable without changing the response schema.

Duplicate / Related Work Audit

I checked current main and GitHub issues/PRs for the same fix. I did not find an existing issue or PR that preserves xAI video wrapper timeout/transport error types.

Related but not duplicate:

Validation

  • pytest tests/plugins/video_gen -> 46 passed
  • git diff --check

@alt-glitch alt-glitch added type/bug Something isn't working comp/plugins Plugin system and bundled plugins provider/xai xAI (Grok) tool/vision Vision analysis and image generation P3 Low — cosmetic, nice to have labels Jul 2, 2026
@EndeavorYen
EndeavorYen marked this pull request as ready for review July 2, 2026 16:50
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused fix. Current main still collapses every exception escaping _run_xai_video_coroutine() into api_error at plugins/video_gen/xai/__init__.py:540-544. Generation, edit, and extend all pass through that wrapper at plugins/video_gen/xai/__init__.py:472, :496, and :512, so the PR's classifier addresses the complete synchronous wrapper boundary without changing the response shape.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have provider/xai xAI (Grok) sweeper:blast-contained Sweeper blast radius: contained — one narrow path / opt-in / few users sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/vision Vision analysis and image generation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants