feat(linux): add CUDA backend build recipe - #1044
Conversation
📝 WalkthroughWalkthroughThe Linux ChangesCUDA server build
Estimated code review effort: 2 (Simple) | ~5 minutes Mergeability Score: 🔵 Low · up to The new Linux CUDA installation flow can remove the working backend before the replacement is fully installed, so an interrupted or failed update may leave CUDA unavailable until rebuilt. Stage the replacement before swapping it in; also confirm the Python executable is safely quoted. Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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 `@justfile`:
- Around line 250-253: Update the CUDA backend installation flow around the rm,
mkdir, cp, and chmod commands to stage the complete onedir tree in a temporary
sibling directory first. Apply permissions to the staged voicebox-server-cuda,
then atomically replace the existing backends/cuda directory only after staging
succeeds, preserving the current backend until replacement is ready.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda" | ||
| mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda" | ||
| cp -a backend/dist/voicebox-server-cuda/. "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda/" | ||
| chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda/voicebox-server-cuda" |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Stage the replacement before deleting the current backend.
Line 250 deletes the installed CUDA backend before the copy and permission update complete. If staging fails or is interrupted, the target leaves no usable CUDA backend. Copy into a temporary sibling directory, set the executable bit there, and replace backends/cuda only after the complete onedir tree is ready.
Proposed staging change
- rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda"
- mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda"
- cp -a backend/dist/voicebox-server-cuda/. "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda/"
- chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda/voicebox-server-cuda"
+ set -eu; \
+ dest="${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends"; \
+ mkdir -p "$dest"; \
+ tmp="$(mktemp -d "$dest/.cuda.XXXXXX")"; \
+ trap 'rm -rf "$tmp"' 0; \
+ cp -a backend/dist/voicebox-server-cuda/. "$tmp/"; \
+ chmod +x "$tmp/voicebox-server-cuda"; \
+ rm -rf "$dest/cuda"; \
+ mv "$tmp" "$dest/cuda"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| rm -rf "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda" | |
| mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda" | |
| cp -a backend/dist/voicebox-server-cuda/. "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda/" | |
| chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends/cuda/voicebox-server-cuda" | |
| set -eu; \ | |
| dest="${XDG_DATA_HOME:-$HOME/.local/share}/sh.voicebox.app/backends"; \ | |
| mkdir -p "$dest"; \ | |
| tmp="$(mktemp -d "$dest/.cuda.XXXXXX")"; \ | |
| trap 'rm -rf "$tmp"' 0; \ | |
| cp -a backend/dist/voicebox-server-cuda/. "$tmp/"; \ | |
| chmod +x "$tmp/voicebox-server-cuda"; \ | |
| rm -rf "$dest/cuda"; \ | |
| mv "$tmp" "$dest/cuda" |
🤖 Prompt for 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.
In `@justfile` around lines 250 - 253, Update the CUDA backend installation flow
around the rm, mkdir, cp, and chmod commands to stage the complete onedir tree
in a temporary sibling directory first. Apply permissions to the staged
voicebox-server-cuda, then atomically replace the existing backends/cuda
directory only after staging succeeds, preserving the current backend until
replacement is ready.
Adds a Linux implementation of the existing build-server-cuda recipe.
The Python builder already supports --cuda cross-platform, but the justfile only exposed the CUDA build/install flow on Windows. This adds the equivalent Linux path and installs the generated backend into the app data directory under XDG_DATA_HOME (falling back to ~/.local/share).
Tested successfully on:
This keeps the Linux behavior aligned with the existing Windows build-server-cuda recipe.
Summary by CodeRabbit