Repository navigation
Conversation
ef25dc5 to
271a142
Compare
271a142 to
8c52fbe
Compare
8c52fbe to
db8c530
Compare
|
This looks to be like it' should improve the commit user turn public API to behave like how most developers would assume (i.e. that awaiting it means the current turn is commited to chat context of the LLM for all subsequent calls) so sounds great to me. I'm conscious that it is technically a breaking change in behaviour, so if the livekit maintainers think it's too radical, we could potentially have an optional flag on commit user turn that enables this behaviour and keep default behaviour same? Or vice versa, a flag to revert to old behaviour. I say this as maybe in some situations, maybe devs would favour the current behaviour whereby it immediately resolves without waiting for the current turn chat context to be added? I'm not sure though if such a use case really exists, my company does not have, so don't treat this comment as a change request but more just a question to the maintainers about whether we can include an improvement in behaviour of this method if it changes the behaviour slightly |
|
Thanks — that is a fair compatibility concern. This PR deliberately keeps the existing Keeping the old timing as the default would preserve the stale-history race from #7585, including the otherwise natural If the maintainers consider the timing compatibility risk significant, I am happy to add an explicit compatibility option or adjust the default they prefer. Until then I would keep the barrier semantics in this PR rather than expanding the API speculatively. |
Summary
Future[str]API while making its completion a reliable turn-processing barrierskip_reply, caller-cancellation shielding, and current-turn error propagationWhy
commit_user_turn()currently resolves after end-of-turn handling is only scheduled. A caller that awaits it and immediately callsgenerate_reply()can therefore race the chat-context append and generate against stale history.The barrier is scoped to the exact turn started by the call. Resumed speech can replace the end-of-turn task without cancelling the caller, an earlier automatic endpoint cannot capture the manual token, and a later unrelated turn cannot hijack the wait.
Tests
skip_reply, cancellation, and failure propagationmake checkpasses, including formatting, lint, and mypy across 698 source filesFixes #7585
Supersedes #7688, which I accidentally opened from my secondary GitHub account. This PR contains the same implementation, rebased on current
mainand consolidated into one clean commit under my primary account.