fix(liveavatar): honor agent.state_updated for speaking and barge-in - #7245
Open
cpruijsen wants to merge 1 commit into
Open
fix(liveavatar): honor agent.state_updated for speaking and barge-in#7245cpruijsen wants to merge 1 commit into
cpruijsen wants to merge 1 commit into
Conversation
The LITE server now reports avatar state via agent.state_updated; ignoring it left _avatar_speaking false so agent.interrupt never reached the server.
Contributor
There was a problem hiding this comment.
Devin Review found 2 potential issues.
1 flag not posted on this PR by your GitHub settings β view it in Devin Review. (Configure)
Comment on lines
+383
to
+384
| elif event_type == "error": | ||
| logger.error(f"LiveAvatar error: {event.get('error', event)}") |
Contributor
Comment on lines
+385
to
+386
| elif event_type == "warning": | ||
| logger.warning(f"LiveAvatar warning: {event.get('warning', event)}") |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
agent.state_updatedwithnew_state == "talking"follows the existing speak-started path; leaving talking (idle/listening) follows speak-ended.speak_*still work and are idempotent if a session emits both. Buffer append/commit are treated as command acks, not playback lifecycle.agent.audio_buffer_clearedis treated as the interrupt ack.error/warningare logged at the matching level.LiveAvatar LITE emits
agent.state_updated(idle/listening/talking) andagent.audio_buffer_*acks during a conversation. The plugin only handledsession.state_updatedandagent.speak_*, so_avatar_speakingnever became true, playback start/finish were never notified from the server, and barge-in skippedagent.interrupt.Decision
Speaking and playback are driven from
agent.state_updated, notaudio_buffer_appendedβ started andaudio_buffer_committedβ ended (the mapping sketched in the issue). The LITE events spec defines buffer events as command acks andagent.state_updatedas the avatar speaking signal; the reporter also observedagent.state_updatedon a real sandbox session. Mapping commit to "playback finished" would end playout on thespeak_endack, which can fire while the avatar is still talking. Can switch if append/commit should own playback instead.Fixes #7232
Test plan
tests/test_plugin_liveavatar.py(pytest.mark.unit):agent.state_updatedtalking/listening updates_avatar_speakingand playback notifications; buffer append/commit do not; speak_started + talking is one playback-started; barge-in sendsagent.interruptafter talking and does not after append-only.livekit-plugins/livekit-plugins-liveavatar/tests/test_api.py.LIVEAVATAR_API_KEY/LIVEAVATAR_AVATAR_ID: DEBUG should no longer print Unhandled foragent.state_updated/agent.audio_buffer_*, and interrupting mid-reply should sendagent.interrupt.