From b4eb6c0cb1145378c12be60f205eba1f92b6fb4c Mon Sep 17 00:00:00 2001 From: lzx1413 Date: Thu, 30 Jul 2026 08:04:38 +0000 Subject: [PATCH 1/2] feat(stream): time-slice retained LingBot sessions Load one shared stream service per in-process model worker while retaining multiple independent LiveKit room and pipeline sessions. Add retained-session admission capacity, control-idle execution leases, chunk-boundary handoff, aggregate worker health, and controller heartbeats. Clarify service-instance, queue, lifecycle, GPU placement, and observability semantics across the English and Chinese documentation. Add focused lease, worker, capacity, CLI, runtime, and action-loop coverage, and isolate localhost server tests from process-level proxies. Verified with full Ruff and import checks, 857 CI-selected unit tests, 62 server tests, strict bilingual MkDocs build, and git diff checks. --- README.md | 9 +- docs/en/index.md | 2 +- docs/en/service.md | 10 + docs/en/stream_scheduler.md | 23 +- docs/en/stream_server.md | 103 +++++-- docs/zh/index.md | 2 +- docs/zh/service.md | 9 + docs/zh/stream_scheduler.md | 21 +- docs/zh/stream_server.md | 95 +++++-- examples/lingbot/README.md | 15 +- examples/stream_server/README.md | 7 + examples/stream_server/_control_demo_ui.py | 8 +- .../livekit_bidirectional_demo.py | 1 + telefuser/entrypoints/cli/main.py | 33 ++- .../pipelines/lingbot_world_fast/lease.py | 254 ++++++++++++++++++ .../pipelines/lingbot_world_fast/service.py | 190 +++++++++++-- .../pipelines/lingbot_world_fast/session.py | 1 + telefuser/service/livekit/config.py | 11 + telefuser/service/livekit/main.py | 4 + .../service/livekit/multi_session_worker.py | 140 ++++++++++ telefuser/service/livekit/runtime.py | 17 +- telefuser/service/livekit/scheduler.py | 57 ++-- tests/server/conftest.py | 7 + .../test_execution_lease.py | 120 +++++++++ .../test_service_action_loop.py | 30 ++- tests/unit/service/livekit/test_cli.py | 6 + tests/unit/service/livekit/test_config.py | 10 + tests/unit/service/livekit/test_demo.py | 2 + .../livekit/test_multi_session_capacity.py | 107 ++++++++ .../livekit/test_multi_session_worker.py | 227 ++++++++++++++++ tests/unit/service/livekit/test_runtime.py | 17 ++ 31 files changed, 1422 insertions(+), 116 deletions(-) create mode 100644 telefuser/pipelines/lingbot_world_fast/lease.py create mode 100644 telefuser/service/livekit/multi_session_worker.py create mode 100644 tests/unit/pipelines/lingbot_world_fast/test_execution_lease.py create mode 100644 tests/unit/service/livekit/test_multi_session_capacity.py create mode 100644 tests/unit/service/livekit/test_multi_session_worker.py diff --git a/README.md b/README.md index 94286cc..c769c37 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ TeleFuser is a high-performance runtime for world model inference and multimodal ## News 📰 -- ✨ **2026-07-27**: Unified streaming on LiveKit with room sessions, worker admission, reconnect-friendly browser - transport, and support for both server-push and bidirectional pipeline contracts. +- ✨ **2026-07-27**: Unified streaming on LiveKit with room sessions, retained multi-session admission, LingBot + chunk-boundary time slicing, reconnect-friendly browser transport, and server-push/bidirectional contracts. - ✨ **2026-07-22**: **NEW** Added [**LingBot-Video**](examples/lingbot_video/README.md) support for Dense and MoE T2I/T2V/TI2V generation, native four-GPU CFG/SP execution, and in-memory MoE refinement. - ✨ **2026-07-15**: Added [**LingBot-World v2**](https://github.com/Robbyant/lingbot-world-v2) support for offline generation, interactive WebRTC streaming, and multi-GPU inference. @@ -140,9 +140,14 @@ telefuser stream-serve examples/lingbot/lingbot_world_v2_image_to_video_h100.py --livekit-url ws://127.0.0.1:7880 \ --livekit-api-key devkey --livekit-api-secret secret \ --num-workers 1 --worker-gpu-map 0,1,2,3 \ + --max-sessions-per-worker 2 --control-idle-timeout 10 \ --port 8088 --skip-validation ``` +This is one four-GPU model worker and one loaded LingBot service instance, not four replicas. It can retain two +independent user sessions; the shared LingBot execution lease runs at most one session chunk at a time and yields at +a chunk boundary after the active controller becomes idle while another session waits. + Terminal 4 — serve the browser controller and proxy its session API: ```bash diff --git a/docs/en/index.md b/docs/en/index.md index 451adfd..affd8a2 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -99,7 +99,7 @@ telefuser stream-serve examples/lingbot/lingbot_world_fast_image_to_video_h100.p