[Bugfix] Keep resumable duplex prompts out of async-chunk prewarm (#7992)
Signed-off-by: Tianyao Wu <rayroy31@gmail.com>
This commit is contained in:
1 parent
f3f8ebfc25
commit
ba5b7485a7
2 files changed
+23
-3
No files matched your search
@@ -307,6 +307,24 @@ async def test_append_submits_the_resumable_stage0_request_and_counts_it_running
|
|||||||
assert counter.value == 0
|
assert counter.value == 0
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_resumable_append_prompt_does_not_reach_prewarmed_stages() -> None:
|
||||||
|
# A resumable append carries Stage0's duplex buffer. The async-chunk
|
||||||
|
# prewarm copies ``request_state.prompt`` into downstream placeholders,
|
||||||
|
# so that buffer must not end up there (#7962).
|
||||||
|
orchestrator, clients, rpc_q, _ = _build(stages=2)
|
||||||
|
orchestrator.async_chunk = True
|
||||||
|
orchestrator._stage_receives_async_chunks = lambda stage_id: stage_id > 0 # type: ignore[method-assign]
|
||||||
|
await _open(orchestrator, rpc_q)
|
||||||
|
|
||||||
|
await _submit(orchestrator, _append_audio())
|
||||||
|
|
||||||
|
assert clients[0].add_request_calls[0][0].model_intermediate_buffer
|
||||||
|
assert len(clients[1].add_request_calls) == 1
|
||||||
|
assert clients[1].add_request_calls[0][0].model_intermediate_buffer is None
|
||||||
|
await orchestrator.session_manager.shutdown()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_session_update_refreshes_the_next_append_sampling_params() -> None:
|
async def test_session_update_refreshes_the_next_append_sampling_params() -> None:
|
||||||
orchestrator, clients, rpc_q, _ = _build()
|
orchestrator, clients, rpc_q, _ = _build()
|
||||||
|
|||||||
@@ -357,9 +357,6 @@ class DuplexOrchestrator(Orchestrator, DuplexStagePort):
|
|||||||
if not isinstance(request_state, DuplexOrchestratorRequestState):
|
if not isinstance(request_state, DuplexOrchestratorRequestState):
|
||||||
raise RuntimeError(f"duplex request was not preregistered: {context.request_id}")
|
raise RuntimeError(f"duplex request was not preregistered: {context.request_id}")
|
||||||
request_state.streaming.enabled = submission.resumable
|
request_state.streaming.enabled = submission.resumable
|
||||||
# Keep raw Stage0 prompt (additional_information / multi_modal_data) for
|
|
||||||
# stage input processors via process_engine_inputs.
|
|
||||||
request_state.prompt = dict(submission.prompt)
|
|
||||||
if submission.resumable:
|
if submission.resumable:
|
||||||
request = build_engine_core_request_from_tokens(
|
request = build_engine_core_request_from_tokens(
|
||||||
request_id=context.request_id,
|
request_id=context.request_id,
|
||||||
@@ -369,6 +366,11 @@ class DuplexOrchestrator(Orchestrator, DuplexStagePort):
|
|||||||
resumable=True,
|
resumable=True,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
# Keep raw Stage0 prompt (additional_information / multi_modal_data) for
|
||||||
|
# stage input processors via process_engine_inputs. Resumable requests
|
||||||
|
# leave it unset: their prompt is one append with Stage0's duplex
|
||||||
|
# buffer, which the async-chunk prewarm would copy downstream.
|
||||||
|
request_state.prompt = dict(submission.prompt)
|
||||||
# Use the ordinary multimodal input processor for turn-model plugins.
|
# Use the ordinary multimodal input processor for turn-model plugins.
|
||||||
# Its CPU preprocessing runs off the session/orchestrator event loop.
|
# Its CPU preprocessing runs off the session/orchestrator event loop.
|
||||||
request = await asyncio.to_thread(
|
request = await asyncio.to_thread(
|
||||||
|
|||||||
Reference in new issue
Block a user