Skip to content

fix: distinguish transient plugin-not-installed from truly invalid pipeline ID (#936)#938

Open
livepeer-tessa wants to merge 1 commit intomainfrom
fix/936-plugin-race-pipeline-id
Open

fix: distinguish transient plugin-not-installed from truly invalid pipeline ID (#936)#938
livepeer-tessa wants to merge 1 commit intomainfrom
fix/936-plugin-race-pipeline-id

Conversation

@livepeer-tessa
Copy link
Copy Markdown
Contributor

Summary

Fixes #936

At cloud session init the frontend sends two concurrent requests — one to install a plugin and one to load its pipeline. If the load request arrives before the plugin finishes registering, _load_pipeline_implementation falls through to a generic ValueError("Invalid pipeline ID: ...")) and _load_pipeline_by_id_sync logs it at ERROR level with the unhelpful consider removing the models directory suggestion. The session recovers silently on the next retry (~1-2 min), but the misleading error creates confusion.

Changes

1. New exception class — PipelineNotYetRegisteredException

Added PipelineNotYetRegisteredException(ValueError) near the top of pipeline_manager.py. This makes the transient case distinguishable from a genuinely unknown pipeline ID.

2. _load_pipeline_implementation — raise typed exception

The final else: raise ValueError(f"Invalid pipeline ID: {pipeline_id}") is now raise PipelineNotYetRegisteredException(...). No other code paths change.

3. _load_pipeline_by_id_sync — catch before generic handler

Added a dedicated except PipelineNotYetRegisteredException clause before the existing except Exception block:

  • Logs at WARN (not ERROR) with a friendly, actionable message.
  • Sets pipeline status to NOT_LOADED (not ERROR) so the frontend never shows an error state and the load can be retried transparently once the plugin finishes installing.
  • Does not publish an error Kafka event (it is not a real error).
  • Signals the load event so any blocked waiters are unblocked.

4. Tests

New file tests/test_pipeline_race_condition.py (9 tests):

  • Verifies PipelineNotYetRegisteredException is raised for unknown non-builtin IDs.
  • Verifies _load_pipeline_by_id_sync returns False without setting status to ERROR.
  • Verifies no ERROR-level log is emitted.
  • Verifies a WARNING-level log is emitted mentioning plugin/installing.
  • Verifies the load event is set (waiters unblocked).
  • Verifies built-in pipelines are unaffected.

…peline ID (#936)

Signed-off-by: Tessa (livepeer-tessa) <tessa@livepeer.org>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 14, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 82d18545-a873-4f91-b2fc-87146421b567

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/936-plugin-race-pipeline-id

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.

@github-actions
Copy link
Copy Markdown
Contributor

🚀 fal.ai Preview Deployment

App ID daydream/scope-pr-938--preview
WebSocket wss://fal.run/daydream/scope-pr-938--preview/ws
Commit 0d581c3

Livepeer Runner

App ID daydream/scope-livepeer-pr-938--preview
WebSocket wss://fal.run/daydream/scope-livepeer-pr-938--preview/ws
Auth private

Testing Livepeer Mode

SCOPE_CLOUD_MODE=livepeer SCOPE_CLOUD_APP_ID="daydream/scope-livepeer-pr-938--preview/ws" uv run daydream-scope

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.

[fal.ai] yolo_mask: "Invalid pipeline ID" on session init when plugin not yet installed — race between plugin install and pipeline load

1 participant