Skip to content

fix: log exception when output guardrail raises instead of silently ignoring#3411

Open
cty-ut wants to merge 2 commits into
openai:mainfrom
cty-ut:fix/realtime-guardrail-log-exception
Open

fix: log exception when output guardrail raises instead of silently ignoring#3411
cty-ut wants to merge 2 commits into
openai:mainfrom
cty-ut:fix/realtime-guardrail-log-exception

Conversation

@cty-ut
Copy link
Copy Markdown
Contributor

@cty-ut cty-ut commented May 14, 2026

Summary

In RealtimeSession._run_output_guardrails(), exceptions raised by individual
guardrails were silently swallowed with a bare except Exception: continue.
If a guardrail has a bug or misconfiguration, it fails invisibly with no log
output and no way to diagnose the issue.

Fix: add logger.exception(...) before continue so the error is surfaced
in logs while still allowing the remaining guardrails to run.

Test plan

Existing realtime tests continue to pass (make tests). The change is a
one-line addition of a log call in an existing exception handler.

Issue number

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

Comment thread src/agents/realtime/session.py Outdated
@seratch seratch added this to the 0.17.x milestone May 15, 2026
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