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.
The precreated response has two other owners the compensation defers to. When the runner cancels the append on purpose (DuplexSessionTasks.cancel_append_tasks, for a response.cancel, a barge-in or a close), the runner ends that response itself right after, with the cancel status the client asked for. When the session is already closing, the close ends it. Everywhere else, the append is the last thing that knows the response will never be filled, and it fails it.
AppendAttempt dataclass ¶
One queued append to the model, with the rollback each failure path owes.
on_append_accepted class-attribute instance-attribute ¶
retained_committed_payload instance-attribute ¶
abandon ¶
Give back everything this append reserved but never used.
That includes the response it precreated: once the append is off, nothing will ever fill it, and a client that saw response.created is owed a response.done. It is left alone only when somebody else ends it: the runner that cancelled this append on purpose (response_taken_over) or the close already under way.
clear_pending_silence ¶
Done-callback of a silence continuation: it is no longer pending.
discard_retained_audio ¶
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 ¶
Done-callback: a cancelled or failed append must not hold the audio.
run_in_wire_order async ¶
Wait for the previous append, then submit this one if it still applies.
A cancellation is compensated here, wherever it lands (waiting for the predecessor or mid-submit): the reservations go back, and the precreated response is failed unless the runner cancelled the append itself, in which case it ends the response with the status the cancellation was for.