Skip to content

Add ComfyStream live-runner for go-livepeer orchestrators - #594

Draft
eliteprox wants to merge 14 commits into
mainfrom
feat/comfypeer-liverunner
Draft

Add ComfyStream live-runner for go-livepeer orchestrators#594
eliteprox wants to merge 14 commits into
mainfrom
feat/comfypeer-liverunner

Conversation

@eliteprox

Copy link
Copy Markdown
Collaborator

Summary

  • Add a Livepeer live-runner path that registers ComfyStream as app comfystream (capacity 1) against a go-livepeer orchestrator with -useLiveRunners, driving comfystream.Pipeline in-process (no BYOC/pytrickle subprocess).
  • Expose an agent-shaped HTTP surface for video-in→text-out and live trickle sessions: POST /analyze, POST /start_stream, POST /update_stream, GET /text, GET /healthz.
  • Ship Docker packaging (Dockerfile.live-runner, docker-compose.live-runner.yml, --live-runner entrypoint), optional .[live-runner] deps, a smoke client, and a stub analyze workflow.
  • Also includes supporting workspace/ComfyUI cwd cleanup (--workspace / --cwd), constraint/override-based node installs, and CI workflow fork-restriction removals needed to operate from this branch.

Motivation

ComfyPeer / live-runner work wants ComfyStream sellable as a session wall-clock / latency runner on an existing orchestrator—same registration + trickle path as the transcode live-runner—rather than a batch $/image race or legacy BYOC.

What's included

Live-runner

Piece Role
server/live_runner.py Register runner, create trickle channels, run Pipeline sessions
server/live_runner_client.py Smoke client: reserve → analyze/stream → update → stop
docker/Dockerfile.live-runner Overlay image on livepeer/comfystream + livepeer-gateway
docker-compose.live-runner.yml Host-network attach to an already-running orchestrator
docker/entrypoint.sh --live-runnerpython server/live_runner.py …
workflows/comfystream/analyze-stub-api.json Minimal video→text stub for bring-up
pyproject.toml Optional live-runner extra

Supporting (earlier on branch)

  • Normalize ComfyUI workspace handling (--workspace, config passthrough, client init)
  • Script/dependency hygiene (constraints.txt, overrides.txt, setup_nodes / build_trt)
  • Remove GitHub Actions repo-owner guards so fork CI can run

Legacy BYOC (server/byoc.py) is unchanged.

Quick test

# Attach to an orchestrator that already has -useLiveRunners
docker compose -f docker-compose.live-runner.yml up -d --build
curl -sk "$LIVEPEER_ORCH_URL/discovery" | jq '.[].runners[].app'

pip install '.[live-runner]'
python server/live_runner_client.py sample.mp4 \
  --workflow workflows/comfystream/analyze-stub-api.json \
  --discovery "$LIVEPEER_ORCH_URL/discovery"

Test plan

  • Compose build succeeds; runner appears in orchestrator discovery as comfystream
  • Smoke client analyze against stub workflow returns text
  • start_stream + frame publish produces trickle video (and optional text)
  • update_stream applies mid-session workflow/prompt change
  • Orchestrator session release cleans up active session (capacity returns to 1)
  • /healthz healthy while idle and during a session
  • Confirm secrets/host defaults in docker-compose.live-runner.yml are overridden via env (no committed orch secrets in final merge)
  • Existing WebRTC / BYOC paths still work; workspace --config still preserves --workspace

Notes / follow-ups

  • Depends on livepeer-gateway branch ja/live-runner until that lands on a tagged release.
  • Compose file currently carries host-specific GPU UUID / orch URL defaults—should be env-only before merge.
  • Protobuf: live-runner image installs protobuf>=6.31.1 for gateway pb2; call out any ComfyUI pin tension in review.

Copilot AI and others added 14 commits January 10, 2026 06:42
Co-authored-by: eliteprox <16746274+eliteprox@users.noreply.github.com>
Remove repository restrictions from GitHub workflows to enable fork operation
- Standardize on --workspace (with --cwd alias) so ComfyStream can launch from any directory while mapping to the correct ComfyUI cwd.
- Pass the workspace/CWD and logging settings cleanly through server args → pipeline → ComfyStreamClient so ComfyUI’s configuration is honored.
- Add config passthrough support: when a ComfyUI config file is provided, forward it directly and skip overriding flags to match ComfyUI’s precedence rules.
- Ensure ComfyUI packages load correctly via the client initialization (__init__.py/ComfyStreamClient), removing legacy env handling and relying on proper cwd/config inputs.
- Update Docker, supervisord, launch configs, and docs to use the unified workspace flag and defaults.
This reverts commit 6853675.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: eliteprox <16746274+eliteprox@users.noreply.github.com>
Preserve workspace cwd when using --config in frame_processor
- Cleaned up __init__.py by removing unused imports and defining __all__.
- Introduced overrides.txt for managing package dependencies with specific versions and extra index URLs.
- Updated setup_models.py and setup_nodes.py to improve configuration handling and error reporting during node installations.
- Enhanced utils.py with new functions for workspace management and improved config path resolution.
…ng and dependency management

- Refactored build_trt.py to include a setup_comfy function for better workspace initialization and module imports.
- Added a workspace argument to build_trt_engine for flexibility in specifying the ComfyUI workspace.
- Updated constraints.txt to pin specific versions of onnxruntime and huggingface-hub, and added a new dependency for transformers.
- Modified setup_nodes.py to utilize a centralized constraints file for pip installations, ensuring consistent dependency management across custom nodes.
… dependency management and module imports

- Added import for comfy.sd in build_trt.py to streamline module access.
- Updated constraints.txt to include a new dependency on nvidia-modelopt with a minimum version requirement.
- Modified setup_nodes.py to handle nvidia-modelopt version conflicts by stripping unnecessary extras from the package line.
- Introduced docker-compose.live-runner.yml to facilitate running ComfyStream as a live-runner connected to an existing Livepeer orchestrator.
- Created Dockerfile.live-runner to build the necessary environment for the live-runner, including dependencies for livepeer-gateway.
- Updated entrypoint.sh to handle the new --live-runner flag for starting the service.
- Added server/live_runner.py to implement the live-runner functionality, enabling video analysis and live streaming.
- Developed server/live_runner_client.py as a smoke client for testing the live-runner features.
- Enhanced README.md with instructions for using the live-runner and added a new workflow JSON for analysis.
- Updated pyproject.toml to include live-runner dependencies.
- Ensured proper integration with Livepeer's API for session management and media handling.
Comment thread server/live_runner.py
raise
except Exception as exc:
log.exception("failed to apply analyze workflow")
raise web.HTTPBadRequest(text=f"invalid workflow: {exc}") from exc
Comment thread server/live_runner.py
)
except Exception as exc:
log.exception("failed to apply stream workflow")
raise web.HTTPBadRequest(text=f"invalid workflow: {exc}") from exc
Comment thread server/live_runner.py
)
except Exception as exc:
log.exception("failed to update stream workflow")
raise web.HTTPBadRequest(text=f"invalid workflow update: {exc}") from exc
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.

3 participants