Skip to content

Fix: status check reported ready before models finished loading (#4) - #12

Open
carochacs wants to merge 3 commits into
got-feedBack:mainfrom
get-flashbacks:fix-for-pr
Open

Fix: status check reported ready before models finished loading (#4)#12
carochacs wants to merge 3 commits into
got-feedBack:mainfrom
get-flashbacks:fix-for-pr

Conversation

@carochacs

@carochacs carochacs commented Aug 2, 2026

Copy link
Copy Markdown

ls_status() treated any HTTP 200 from /health as "alignment server ready", but the demucs-server responds 200 with status:"ok" as soon as the process is up -- well before whisperx (needed for /align's VAD-anchored windows) finishes downloading/loading. During that window /health's own warmup block already reports e.g. whisperx: "downloading".

This showed a green "Alignment server ready" notice while a request would still hit the server mid-warmup, then fail with a confusing "Cannot connect to alignment server" the moment the user actually clicked Align -- despite the ready notice being visible seconds earlier.

ls_status() now inspects /health's warmup.whisperx field and only reports available:true once it's "ready", surfacing an accurate "still loading" reason otherwise. Per-language aligners load lazily on demand and are not gated on here.

Summary by CodeRabbit

  • Bug Fixes

    • Improved synchronization availability checks by confirming the processing server is healthy and its required model is ready.
    • Reports clear loading or unavailable statuses when synchronization cannot be used.
    • Restricted server connections to approved local or private HTTP(S) destinations without credentials or URL parameters.
    • Prevented automatic redirects during alignment requests for safer, more predictable processing.
  • Documentation

    • Updated requirements to specify Demucs Server v2 or later and document readiness checks.

ls_status() treated any HTTP 200 from /health as "alignment server ready",
but the demucs-server responds 200 with status:"ok" as soon as the process
is up -- well before whisperx (needed for /align's VAD-anchored windows)
finishes downloading/loading. During that window /health's own `warmup`
block already reports e.g. `whisperx: "downloading"`.

This showed a green "Alignment server ready" notice while a request would
still hit the server mid-warmup, then fail with a confusing "Cannot
connect to alignment server" the moment the user actually clicked Align --
despite the ready notice being visible seconds earlier.

ls_status() now inspects /health's `warmup.whisperx` field and only
reports available:true once it's "ready", surfacing an accurate
"still loading" reason otherwise. Per-language aligners load lazily on
demand and are not gated on here.

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

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 Plus

Run ID: be2b35f6-2d3e-4671-aa34-ff5e1eed8f1c

📥 Commits

Reviewing files that changed from the base of the PR and between e7192a3 and af47801.

📒 Files selected for processing (1)
  • routes.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • routes.py

📝 Walkthrough

Walkthrough

The routes now restrict configured Demucs URLs to approved local or private HTTP(S) destinations. The status endpoint requires HTTP 200 and warmup.whisperx == "ready". Alignment requests do not follow redirects.

Changes

Demucs validation

Layer / File(s) Summary
Demucs URL validation and request handling
routes.py
Configured Demucs URLs reject credentials, query strings, fragments, and non-local or non-private hosts. Alignment requests disable redirects.
Health and WhisperX readiness validation
routes.py, README.md
The status endpoint validates the health response and reports availability only when WhisperX is ready. The requirements document describes the same readiness checks.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LyricsSync as Lyrics sync route
  participant Demucs as Demucs server
  participant WhisperX as WhisperX warmup
  LyricsSync->>Demucs: Request /health without redirects
  Demucs-->>LyricsSync: Return HTTP 200 and health JSON
  LyricsSync->>WhisperX: Read warmup.whisperx
  WhisperX-->>LyricsSync: Return readiness state
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: preventing the status check from reporting readiness before model loading completes.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
routes.py (1)

99-113: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the new /health readiness contract.

README.md:22-26 documents the /align endpoint and the configured server URL, but not the required HTTP 200 response with warmup.whisperx == "ready". Add this requirement and the loading behavior so operators can diagnose an unavailable status. Confirm that supported Demucs server versions expose this field.

🤖 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 `@routes.py` around lines 99 - 113, Update the README section documenting the
alignment server URL and /align endpoint to require HTTP 200 with
warmup.whisperx equal to "ready" before the server is considered available.
Document that the server may return 200 while WhisperX is still
downloading/loading, and note the supported Demucs server versions that expose
this health field so operators can diagnose unavailable status.
🤖 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 `@routes.py`:
- Around line 125-130: Update the unavailable-status reason in the whisperx
readiness check around whisperx_state so unknown and terminal states use the
neutral “Alignment model is not ready ({state})” wording, while preserving the
existing loading-specific message only for transient warmup states.
- Around line 114-119: Validate or restrict the URL returned by
_get_demucs_server_url before the outbound requests in the lyrics sync status
and align handlers, allowing only approved destinations and schemes; ensure
requests.get and requests.post do not follow redirects. Apply the same
protection to both endpoints while preserving the existing unavailable response
for missing or rejected configuration.

---

Nitpick comments:
In `@routes.py`:
- Around line 99-113: Update the README section documenting the alignment server
URL and /align endpoint to require HTTP 200 with warmup.whisperx equal to
"ready" before the server is considered available. Document that the server may
return 200 while WhisperX is still downloading/loading, and note the supported
Demucs server versions that expose this health field so operators can diagnose
unavailable status.
🪄 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 Plus

Run ID: 1cefdde6-e7df-41b3-962d-4c91c39235ca

📥 Commits

Reviewing files that changed from the base of the PR and between f172eef and a9c862f.

📒 Files selected for processing (1)
  • routes.py

Comment thread routes.py Outdated
Comment thread routes.py Outdated
Restrict configured Demucs server URLs to local/private HTTP(S) targets, rejecting credentials and non-local hosts. Health and align requests now disable redirects, and availability messaging better distinguishes known WhisperX warmup states from unknown readiness failures. README requirements were updated to clarify that the plugin only treats the server as available when `/health` is 200 and `warmup.whisperx` is exactly `"ready"`.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@routes.py`:
- Around line 28-29: Update the hostname validation logic around the hostname
allowlist to remove the unconditional host.docker.internal exception, or resolve
it and require the resolved address to pass the existing local/private-network
validation before allowing the request; preserve localhost handling without
permitting requests to public addresses.
🪄 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 Plus

Run ID: 9d34f9eb-8cbf-43a9-9808-95e6c43f82ec

📥 Commits

Reviewing files that changed from the base of the PR and between a9c862f and e7192a3.

📒 Files selected for processing (2)
  • README.md
  • routes.py

Comment thread routes.py Outdated
Removes 'host.docker.internal' from the list of approved hostnames for demucs URLs, limiting approval to 'localhost' only.
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

1 participant