fix(voice): reject unsupported video input#1962
Open
rosetta-livekit-bot[bot] wants to merge 1 commit into
Open
fix(voice): reject unsupported video input#1962rosetta-livekit-bot[bot] wants to merge 1 commit into
rosetta-livekit-bot[bot] wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 6ea73bb The changes in this PR will be included in the next version bump. This PR includes changesets to release 35 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 |
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
VideoInput,_forward_video_atask, orAgentActivity.push_video).RoomIOconfigurations withvideoEnabled: trueinstead of silently accepting unsupported video input that cannot be forwarded or cleaned up.@livekit/agents.Validation
pnpm format:checkpnpm build:agentspnpm test -- agents/src/voice/room_io/room_io.test.tspnpm buildcue-clitext-mode runtime validation with a temporary dispatchable JS agent: assertedconversation_item_added(.item.message.role="ASSISTANT")from framework events.Notes
Ported from livekit/agents#6318
Original PR description
I was just checking this project and saw this, did some test and felt it might be a real bug, so i fixed it and created this PR!
Description
This change resolves a resource leak where the video forwarding task (
_forward_video_atask) was left dangling in the background on session teardown.The Problem
During session teardown (
AgentSession._aclose_impl), the cleanup sequence explicitly cancels and awaits the audio forwarding task (_forward_audio_atask), but completely omitted_forward_video_atask.This omission leads to leaks under two scenarios:
self._activityisNone), the block detaching the inputs is skipped. The active video task is never cancelled and continues running indefinitely.self.input.video = Nonecancels the active task but immediately schedules a new redundant task. Explicitly awaiting the task ensures the event loop is cleanly purged of any scheduled forwarding tasks.The Fix
Added symmetric cancellation and cleanup in
AgentSession._aclose_implmatching the audio task's handling: