Skip to content

fix: validate realtime playback durations - #4546

Closed
hsusul wants to merge 1 commit into
openai:mainfrom
hsusul:fix/realtime-playback-duration-validation
Closed

fix: validate realtime playback durations#4546
hsusul wants to merge 1 commit into
openai:mainfrom
hsusul:fix/realtime-playback-duration-validation

Conversation

@hsusul

@hsusul hsusul commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

RealtimePlaybackTracker.on_play_ms accepted negative, non-finite, and overflowing cumulative playback durations. A later interruption could then fail while converting the invalid elapsed time to the integer audio_end_ms sent to Realtime. This change validates each duration and the prospective cumulative total before mutating tracker state.

Test plan

  • Added focused regressions for negative, NaN, positive/negative infinity, and cumulative float overflow.
  • tests/realtime/test_playback_tracker.py: 26 passed.
  • Broader realtime tests: 105 passed; 9 local websocket integration tests were blocked by the sandbox refusing local socket binding.
  • .agents/skills/code-change-verification/scripts/run.sh: format, lint, typecheck, and full tests passed.
  • git diff --check: passed.

Issue number

Not linked to an issue; this is a directly reproducible public playback-tracker boundary bug.

Checks

  • I've added new tests, if relevant
  • I've run .agents/skills/code-change-verification/scripts/run.sh
  • I've confirmed all verification steps pass
  • If using Codex, I've run /review before submitting this PR

@seratch

seratch commented Aug 21, 2026

Copy link
Copy Markdown
Member

RealtimePlaybackTracker.on_play_ms() accepts the amount of audio actually played. Negative values, non-finite values, and cumulative durations near 1e308 are outside that semantic contract, and the PR does not show a normal playback implementation producing them.

The added tests establish that validation can be implemented, but they do not demonstrate an unmet supported use case or exercise the claimed interruption failure through the public session path. I am going to close this PR for now. If a realistic playback integration can produce an invalid duration during ordinary use, please provide that code path and its observable session impact so we can reconsider the narrowest appropriate boundary.

@seratch seratch closed this Aug 21, 2026
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