Skip to content

fix(openai realtime): keep derived capabilities in sync with update_options - #6943

Merged
longcw merged 2 commits into
mainfrom
longc/rt-caps-follow-update-options
Aug 22, 2026
Merged

longcw merged 2 commits into
mainfrom
longc/rt-caps-follow-update-options

Conversation

@longcw

@longcw longcw commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Problem

capabilities.turn_detection and capabilities.user_transcription come from constructor options, but update_options changed those options and left the capabilities alone.
A model switched to create_response=False does client-side turn taking (#6642), and the stale capability still reports that the server owns the turn.
AgentActivity then refuses allow_interruptions=False, and _resolve_rt_turn_detection_enabled selects the wrong mode for endpointing and for realtime-session reuse across a handoff.
Turn detection is also per session, because session(turn_detection_disabled=True) switches it off for one session, but the only capabilities object was on the model.

Fix

One function now derives server-side turn taking, and both the constructor and update_options call it, so the two cannot drift apart again.
RealtimeSession keeps its own capabilities copy and updates it from its own update_options.
One session can now hand turn taking to the client while the model and its other sessions stay unchanged.
The function also carries the interrupt_response warning, which update_options did not give before.

The turn_detection_disabled branch in the session constructor has no unit test, because a real session opens a websocket in __init__.

…ptions

`capabilities.turn_detection` and `capabilities.user_transcription` are derived
from constructor options, but `update_options` changed those options without
recomputing them. A model switched to `create_response=False` is doing
client-side turn taking (#6642), yet the stale capability still reported the
server owning the turn: `AgentActivity` then refuses `allow_interruptions=False`,
and `_resolve_rt_turn_detection_enabled` picks the wrong mode for endpointing
and for realtime-session reuse across a handoff.

The turn-taking derivation now lives in one function used by both the
constructor and `update_options`, so the two cannot drift apart again. It also
carries the `interrupt_response` warning, which `update_options` never emitted.

Turn detection is per session as well, since `session(turn_detection_disabled=True)`
switches it off for one session while the model keeps it. `RealtimeSession` now
holds its own capabilities copy and updates it from its own `update_options`, so
a session can hand turn taking to the client without changing what the model or
its other sessions report.
@longcw
longcw requested a review from a team as a code owner August 22, 2026 03:15
devin-ai-integration[bot]

This comment was marked as resolved.

The interrupt_response warning was a side effect of deriving the
capability, and update_options re-runs that derivation on every session
the model owns, so one call logged the warning 1 + N times. The
derivation is pure now and only the model warns.
@longcw
longcw merged commit da6af86 into main Aug 22, 2026
26 checks passed
@longcw
longcw deleted the longc/rt-caps-follow-update-options branch August 22, 2026 05:12
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.

2 participants