Skip to content

Commit 902f53c

Browse files
committed
fix: Remove trailing commas causing tuple assignment in response cancellation
The trailing commas on lines 434 and 619 were creating tuples instead of booleans for automatic_response_cancellation_enabled. This caused the condition 'if not automatic_response_cancellation_enabled' to always evaluate to False, preventing _cancel_response() from being called. Impact: Response cancellation was completely broken when interrupt_response=False Fix: Remove trailing commas to return bool instead of tuple Verification: - Before fix: type=tuple, not (False,) = False -> _cancel_response() NOT called - After fix: type=bool, not False = True -> _cancel_response() IS called - All 23 tests pass
1 parent 2630489 commit 902f53c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/agents/realtime/openai_realtime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ async def _send_interrupt(self, event: RealtimeModelSendInterrupt) -> None:
431431
and session.audio is not None
432432
and session.audio.input is not None
433433
and session.audio.input.turn_detection is not None
434-
and session.audio.input.turn_detection.interrupt_response is True,
434+
and session.audio.input.turn_detection.interrupt_response is True
435435
)
436436
if not automatic_response_cancellation_enabled:
437437
await self._cancel_response()
@@ -616,7 +616,7 @@ async def _handle_ws_event(self, event: dict[str, Any]):
616616
and session.audio is not None
617617
and session.audio.input is not None
618618
and session.audio.input.turn_detection is not None
619-
and session.audio.input.turn_detection.interrupt_response is True,
619+
and session.audio.input.turn_detection.interrupt_response is True
620620
)
621621
if not automatic_response_cancellation_enabled:
622622
await self._cancel_response()

0 commit comments

Comments
 (0)