Skip to content

Fix CUDA downloads on unsupported platforms#770

Open
Bortlesboat wants to merge 3 commits into
jamiepine:mainfrom
Bortlesboat:fix/cuda-download-platform-assets
Open

Fix CUDA downloads on unsupported platforms#770
Bortlesboat wants to merge 3 commits into
jamiepine:mainfrom
Bortlesboat:fix/cuda-download-platform-assets

Conversation

@Bortlesboat

@Bortlesboat Bortlesboat commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • prevent the CUDA backend downloader from fetching release assets on platforms without a matching packaged sidecar
  • surface download_supported and unsupported_reason in CUDA status
  • update GPU docs so Linux NVIDIA no longer advertises the Windows CUDA sidecar download flow
  • add regression coverage for Linux status and pre-network download rejection

Fixes #767

Testing

  • python -m pytest backend/tests/test_cuda_download.py -q --basetemp .pytest-tmp
  • python -m py_compile backend/services/cuda.py backend/routes/cuda.py backend/tests/test_cuda_download.py
  • python -m ruff format --check backend/services/cuda.py backend/routes/cuda.py backend/tests/test_cuda_download.py
  • python -m ruff check --select I backend/services/cuda.py backend/routes/cuda.py backend/tests/test_cuda_download.py
  • git diff --check

Summary by CodeRabbit

  • New Features
    • Added platform capability checks that determine whether CUDA downloads are supported and surface an unsupported reason in CUDA status.
  • Bug Fixes
    • Prevents CUDA download requests and startup auto-download/update attempts on unsupported platforms, returning HTTP 409 with a clear reason.
  • Documentation
    • Clarified GPU acceleration guidance for Linux + NVIDIA (use local/remote Python backend with CUDA PyTorch) and adjusted CUDA backend documentation scope.
    • Split combined Windows/Linux NVIDIA entries into separate Windows (NVIDIA) and Linux (NVIDIA) rows.
  • Tests
    • Added coverage for unsupported-platform CUDA download rejection.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 613d688b-d86a-434c-ac32-9ef3da13864b

📥 Commits

Reviewing files that changed from the base of the PR and between 142b985 and c9e4170.

📒 Files selected for processing (1)
  • app/src/lib/api/types.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/src/lib/api/types.ts

📝 Walkthrough

Walkthrough

CUDA binary downloads are now blocked on Linux. A new platform-check constant and three helper functions in backend/services/cuda.py gate all download paths. The status endpoint surfaces download_supported and unsupported_reason. The HTTP download route returns 409 when unsupported. The frontend CudaStatus type is extended with matching fields. Tests, docs, and README are updated to reflect Windows-only CUDA download availability.

Changes

Linux CUDA Download Block

Layer / File(s) Summary
Platform-check constant and helpers
backend/services/cuda.py
Adds CUDA_DOWNLOAD_UNSUPPORTED_REASON constant and is_cuda_download_supported, get_cuda_download_unsupported_reason, ensure_cuda_download_supported helpers that inspect sys.platform and raise RuntimeError on non-Windows.
Service status extension and download gates
backend/services/cuda.py
get_cuda_status() returns new download_supported and unsupported_reason fields; _download_cuda_binary_locked calls ensure_cuda_download_supported() at entry; check_and_update_cuda_binary() exits early with a log on unsupported platforms.
HTTP 409 route guard
backend/routes/cuda.py
POST /backend/download-cuda calls get_cuda_download_unsupported_reason() and raises HTTP 409 before any download or progress checks when on Linux.
Frontend type extension and service tests
app/src/lib/api/types.ts, backend/tests/test_cuda_download.py
CudaStatus gains new fields cuda_libs_version, download_supported, unsupported_reason; tests verify status fields and that _download_cuda_binary_locked raises RuntimeError before making any network calls under Linux.
Documentation and README split
README.md, docs/content/docs/overview/introduction.mdx, docs/content/docs/overview/gpu-acceleration.mdx
The combined Windows/Linux NVIDIA row is split into two rows; the Linux row instructs using a local/remote Python backend; the CUDA backend-swap section heading is narrowed to Windows only.

Sequence Diagram

sequenceDiagram
    participant Client
    participant DownloadRoute as POST /backend/download-cuda
    participant CudaService as cuda.service
    participant StatusEndpoint as GET /backend/cuda-status

    Client->>DownloadRoute: Request download
    DownloadRoute->>CudaService: get_cuda_download_unsupported_reason()
    CudaService-->>DownloadRoute: Returns reason (if Linux)
    alt Unsupported
        DownloadRoute-->>Client: HTTP 409 + reason
    else Supported (Windows)
        DownloadRoute->>CudaService: _download_cuda_binary_locked()
        CudaService->>CudaService: ensure_cuda_download_supported()
        CudaService-->>DownloadRoute: Download proceeds
        DownloadRoute-->>Client: HTTP 200
    end

    Client->>StatusEndpoint: Check CUDA status
    StatusEndpoint->>CudaService: get_cuda_status()
    CudaService->>CudaService: get_cuda_download_unsupported_reason()
    CudaService-->>StatusEndpoint: Status with download_supported + unsupported_reason
    StatusEndpoint-->>Client: Returns extended CudaStatus
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 Hoppy news from the warren today,
No more Windows .exe going Linux's way!
We checked sys.platform with a flick of the paw,
And blocked the bad download with one tidy law.
Linux gets a note, Windows gets the binary treat—
The fix is clean, the logic neat! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. 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 PR title 'Fix CUDA downloads on unsupported platforms' accurately describes the main objective: preventing CUDA downloads on platforms lacking compatible binaries, addressing the root cause of issue #767.
Linked Issues check ✅ Passed The PR implementation directly addresses issue #767 by: (1) preventing CUDA downloads on unsupported platforms via platform support checks, (2) exposing download_supported and unsupported_reason fields in status responses, (3) updating documentation to reflect Linux limitations, and (4) adding regression tests for the fix.
Out of Scope Changes check ✅ Passed All changes are in-scope: README/documentation updates clarify GPU support, API type changes expose download capability information, backend changes implement platform checks, and tests validate the new behavior. No unrelated modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/src/lib/api/types.ts`:
- Around line 290-292: The CudaStatus type definition uses optional properties
(cuda_libs_version, unsupported_reason, and binary_path) but the backend
actually returns these as null values rather than omitting them. Change each of
these optional string properties from the form field?: string to field: string |
null to accurately reflect that these properties are always present in the
response but can have null values instead of being absent entirely.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3bf0eeec-cc64-4516-92ba-4b522a797ffc

📥 Commits

Reviewing files that changed from the base of the PR and between b35b909 and 7dc5dad.

📒 Files selected for processing (7)
  • README.md
  • app/src/lib/api/types.ts
  • backend/routes/cuda.py
  • backend/services/cuda.py
  • backend/tests/test_cuda_download.py
  • docs/content/docs/overview/gpu-acceleration.mdx
  • docs/content/docs/overview/introduction.mdx

Comment thread app/src/lib/api/types.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/src/lib/api/types.ts`:
- Line 291: The download_supported field in the types file is currently marked
as optional with the `?` operator, but since the API always returns this field
as a boolean value, it should be required to accurately match the API contract.
Remove the `?` from the download_supported field declaration to change it from
optional to a required boolean property.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 44e2be05-8cb1-424f-9ece-0e18f1d6df62

📥 Commits

Reviewing files that changed from the base of the PR and between 7dc5dad and 142b985.

📒 Files selected for processing (1)
  • app/src/lib/api/types.ts

Comment thread app/src/lib/api/types.ts Outdated
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.

Bug: Linux CUDA backend download installs Windows executable (voicebox-server-cuda.exe)

1 participant