Skip to content

fix(phonic): apply update_options to every active realtime session - #7163

Open
omChauhanDev wants to merge 1 commit into
livekit:mainfrom
omChauhanDev:fix/phonic-per-session-options
Open

fix(phonic): apply update_options to every active realtime session#7163
omChauhanDev wants to merge 1 commit into
livekit:mainfrom
omChauhanDev:fix/phonic-per-session-options

Conversation

@omChauhanDev

Copy link
Copy Markdown
Contributor

Problem

Every RealtimeSession created from one RealtimeModel shares the model's _RealtimeOptions
instance. update_options decides whether to send a Phonic reset by comparing the requested values
against 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 winner
wrote, so nothing on this side looks wrong.

The same aliasing lets one session's update_instructions overwrite another live session's
instructions 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_options
compares 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 by
update_options, which matches its documented behaviour of changing the active sessions. A session
created 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.

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.
@omChauhanDev
omChauhanDev requested a review from a team as a code owner September 8, 2026 04:52

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant