fix(avatar): skip removal when participant missing#2072
Merged
Conversation
🦋 Changeset detectedLatest commit: a5bf1eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 37 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-authored-by: Cursor <cursoragent@cursor.com>
Use typed session, room, job-context, logger, and audio-output fixtures so cleanup coverage conforms to repository type-safety rules. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
toubatbrian
approved these changes
Jul 20, 2026
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
@livekit/agents.Source diff coverage
Classification
livekit-agents/livekit/agents/voice/avatar/_types.py: ported toagents/src/voice/avatar/avatar_session.ts. The Python change catches LiveKit APITwirpErrorwithcode == "not_found"during avatar participant removal and logs debug instead of warning. The JS SDK does not exportTwirpError, so this was adapted to a structuralcode === "not_found"check on the caught error while preserving warning behavior for all other errors.Validation
a5bf1ebb17b4d16d827d8aea57cffc86c713b649.pnpm test -- agents/src/voice/avatar/avatar_session.test.tspassed: 4/4.pnpm --filter @livekit/agents buildpassed.Runtime validation
RoomServiceClient.removeParticipanterrors after the avatar session closes and emits no framework event that Cue can distinguish.RoomServiceClientboundary. Tests provecode: "not_found"logs at debug without warning, generic errors retain warning behavior, both callremoveParticipantwith the expected room/identity, both detach the registered agent-session and room listeners, and both allowaclose()to resolve.Infrastructure gaps
codefield.Ported from livekit/agents#6486
Original PR description
some avatar provider may disconnect to the room before we cleanup