Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@ build-server: _ensure-venv
Write-Host "Copied sidecar: voicebox-mcp-$triple.exe"

# Build CUDA server binary and place in app data dir for local testing
[linux]
build-server-cuda: _ensure-venv
PATH="{{ venv_bin }}:$PATH" {{ python }} backend/build_binary.py --cuda
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"
Comment on lines +250 to +253

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.

🩺 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.

Suggested 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"
🤖 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.


[windows]
build-server-cuda: _ensure-venv
$ErrorActionPreference = "Stop"; \
Expand Down