fix(inference): don't leak mock participant sid into request headers#1696
Closed
rosetta-livekit-bot[bot] wants to merge 1 commit into
Closed
fix(inference): don't leak mock participant sid into request headers#1696rosetta-livekit-bot[bot] wants to merge 1 commit into
rosetta-livekit-bot[bot] wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: a966084 The changes in this PR will be included in the next version bump. This PR includes changesets to release 34 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 |
Contributor
|
also a python-specific one |
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.
Problem
Running an agent in
consolemode crashes on startup as soon as STT connects:This is a regression from #5937 (agent ID header). That change made
get_inference_headers()readctx.agent.sid— which isroom.local_participant.sid. In console mode the room comes fromcreate_mock_room(), wherelocal_participantis anautospecmock and.sidwas never assigned, so it stayed a truthyMagicMock. The mock passed the truthy check, got added as theX-LiveKit-Agent-IDheader value, and aiohttp then failed to serialize it during the WebSocket handshake — taking down STT and the whole session.Fix
ipc/mock_room.py: pinlocal_participant.sid = ""andidentity = "agent"to real strings, matching how the remote participant already sets.sid.inference/_utils.py: hardenget_inference_headers()to only emit non-emptystrvalues for room/job/agent IDs, so no mock or test context can inject a non-serializable header again.Testing
Verified
consolemode starts and STT connects. Confirmed the mock room now returns a string sid ("", falsy → header omitted, matching the docstring's "omitted in console mode or tests").🤖 Generated with Claude Code