fix(phonic): apply update_options to every active realtime session - #7163
Open
omChauhanDev wants to merge 1 commit into
Open
fix(phonic): apply update_options to every active realtime session#7163omChauhanDev wants to merge 1 commit into
omChauhanDev wants to merge 1 commit into
Conversation
Sessions created from one RealtimeModel shared the model's _RealtimeOptions instance, and update_options decides whether to send a Phonic reset by diffing the requested values against it. The first session updated wrote the new values, so every other session found nothing changed and returned without sending its reset, leaving those conversations on their previous server configuration while reporting the new values locally. Each session now copies the model's options when it is created, as the openai and nvidia realtime models do. Change detection is unchanged, so passing a value a session already holds still sends no reset.
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
Every
RealtimeSessioncreated from oneRealtimeModelshares the model's_RealtimeOptionsinstance.
update_optionsdecides whether to send a Phonic reset by comparing the requested valuesagainst that shared object, so the first session to be updated writes the new values, and every
other session then finds nothing changed and returns without sending its reset.
With three active sessions, one of them sends the reset and the other two keep running their
previous server configuration. Which one wins is not predictable, since the sessions are held in a
WeakSet. All three report the new values locally, because they are reading the object the winnerwrote, so nothing on this side looks wrong.
The same aliasing lets one session's
update_instructionsoverwrite another live session'sinstructions before the initial config is sent.
Changes
Each session now takes its own copy of the model's options when it is created, so
update_optionscompares against the state of the session it is updating. The openai and nvidia realtime models
already do this, for this reason.
Change detection is kept as it was: passing a value a session already holds still sends no reset,
which matters because a redundant reset interrupts the current generation.
RealtimeModel's own options stay the constructor template and are not written byupdate_options, which matches its documented behaviour of changing the active sessions. A sessioncreated after an update previously inherited that update, but only when another session happened to
be alive at the time.
Adds
tests/test_plugin_phonic_realtime.py, the first tests for this plugin.