fix(realtime): advance crossed guardrail thresholds - #4590
Merged
seratch merged 1 commit intoAug 22, 2026
Conversation
seratch
approved these changes
Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
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 -q—198 passedmake 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 with9029 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_workdirremains unavailable on this host because its native sandbox command does not create the expected output file.git diff --check— passedIssue number
N/A
Checks
.agents/skills/code-change-verification/scripts/run.sh/reviewbefore submitting this PR