Skip to content

fix(realtime): apply output guardrails to text deltas - #4124

Merged
seratch merged 3 commits into
mainfrom
fix/realtime-text-output-guardrails
Aug 3, 2026
Merged

fix(realtime): apply output guardrails to text deltas#4124
seratch merged 3 commits into
mainfrom
fix/realtime-text-output-guardrails

Conversation

@seratch

@seratch seratch commented Aug 2, 2026

Copy link
Copy Markdown
Member

This pull request is the first of three focused changes replacing #3933, which will be closed in favor of smaller, independently reviewable pull requests:

  1. Apply output guardrails to text-only Realtime responses.
  2. Fix cancel(mode="after_turn") event-consumption synchronization.
  3. Harden Realtime guardrail recovery and late-audio lifecycle handling.

This pull request addresses only the first item. It normalizes response.output_text.delta events and sends accumulated text through the existing debounce-based guardrail pipeline.

When a text guardrail trips, the session cancels only the originating response by ID without interrupting audio playback. Delayed guardrail results may still be reported, but cannot cancel or inject feedback into a newer response. Existing audio-transcript guardrail behavior remains unchanged.

This focused replacement keeps the cancellation and recovery/audio lifecycle changes from #3933 out of scope so they can be reviewed and validated separately.

Also, this resolves the same issue openai/openai-agents-js#1560 resolves.

@seratch seratch added this to the 0.19.x milestone Aug 2, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b11b93033d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/realtime/config.py
Comment thread src/agents/realtime/openai_realtime.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f529b3d4d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/realtime/session.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6177d05772

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/realtime/session.py Outdated
@seratch
seratch force-pushed the fix/realtime-text-output-guardrails branch from 6177d05 to 0da961c Compare August 2, 2026 23:31

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0da961c92c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/realtime/model.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e6cc4f162f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/agents/realtime/model.py Outdated
Comment thread src/agents/realtime/session.py
Comment thread src/agents/realtime/openai_realtime.py Outdated
@seratch
seratch merged commit d6f82c0 into main Aug 3, 2026
9 checks passed
@seratch
seratch deleted the fix/realtime-text-output-guardrails branch August 3, 2026 00:11
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.

1 participant