Skip to content

vllm_omni.engine.duplex.session.append_task

One append in flight, and what its failure owes the session.

An append is not a call: it is a task queued behind the previous append, which may be cancelled, may find the session closed before it starts, and on any of those paths has to give back what it reserved --- the PCM bytes it took from the input budget, the committed audio it was going to consume, and the response it precreated.

That compensation is the reason this is an object. The five steps of an append all need the same eleven values, so as closures over _start_append they read as one function with five entry points and no way to test any of them. Named fields make the captured state explicit and the compensation a method.

logger module-attribute

logger = init_logger(__name__)

AppendAttempt dataclass

One queued append to the model, with the rollback each failure path owes.

before_append class-attribute instance-attribute

before_append: Callable[[], bool] | None = None

ctx instance-attribute

epoch instance-attribute

epoch: int

fail_session instance-attribute

fail_session: Callable[[str], None]

final instance-attribute

final: bool

model instance-attribute

model: ModelChannel

on_append_accepted class-attribute instance-attribute

on_append_accepted: Callable[[float], None] | None = None

operation_id instance-attribute

operation_id: str | None

out instance-attribute

payload instance-attribute

payload: dict[str, object]

pcm_reservation instance-attribute

pcm_reservation: PcmAppendReservation | None

precreated_response_id instance-attribute

precreated_response_id: str | None

request_id instance-attribute

request_id: str

retained_committed_payload instance-attribute

retained_committed_payload: dict[str, object] | None

abandon

abandon() -> None

Give back everything this append reserved but never used.

clear_pending_silence

clear_pending_silence(done: Task[bool]) -> None

Done-callback of a silence continuation: it is no longer pending.

discard_retained_audio

discard_retained_audio() -> None

Release the committed audio this append was going to consume.

Only if it is still the session's: a later commit may have replaced it, and that one belongs to the append that will carry it.

release_on_failure

release_on_failure(done: Task[bool]) -> None

Done-callback: a cancelled or failed append must not hold the audio.

run_in_wire_order async

run_in_wire_order(predecessor: Task[bool] | None) -> bool

Wait for the previous append, then submit this one if it still applies.