Skip to content

fix(realtime): advance crossed guardrail thresholds - #4590

Merged
seratch merged 1 commit into
openai:mainfrom
hsusul:fix/realtime-guardrail-threshold-progress
Aug 22, 2026
Merged

fix(realtime): advance crossed guardrail thresholds#4590
seratch merged 1 commit into
openai:mainfrom
hsusul:fix/realtime-guardrail-threshold-progress

Conversation

@hsusul

@hsusul hsusul commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Realtime output guardrails run when accumulated text reaches each configured debounce threshold. A single large transcript delta could cross multiple thresholds, but the session advanced its threshold counter by only one. The next small delta could therefore schedule another guardrail check even though the accumulated text had not reached the next threshold.

Advance the counter to the highest threshold crossed by the current accumulated length while preserving the existing behavior for ordinary incremental deltas and legacy non-positive values. This changes no public API, event shape, guardrail result, interruption, or cleanup behavior.

Test plan

  • Added a regression through RealtimeSession.on_event() that sends 12 characters with a threshold of 5, then one additional character. Before the fix, the safe guardrail ran twice; after the fix, it runs once until the next threshold is reached.
  • uv run pytest tests/realtime/test_session.py -q198 passed
  • make typecheck — mypy passed for 307 source files; Pyright reported 0 errors
  • .agents/skills/code-change-verification/scripts/run.sh — format and lint passed; the broad suite completed with 9029 passed, 28 skipped, 3 failed. The failures were unrelated native-sandbox, multiprocessing, and 0.2-second scheduling tests. The multiprocessing and scheduling failures passed when rerun individually; test_python_skill_uses_absolute_root_from_nested_workdir remains unavailable on this host because its native sandbox command does not create the expected output file.
  • git diff --check — passed

Issue number

N/A

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 added this to the 0.22.x milestone Aug 22, 2026
@seratch
seratch merged commit 4f7c1d6 into openai:main Aug 22, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants