Skip to content

fix: #3280 streaming guardrail exception cleanup#3281

Merged
seratch merged 1 commit intoopenai:mainfrom
Aphroq:fix/guardrail-exception-cleanup
May 8, 2026
Merged

fix: #3280 streaming guardrail exception cleanup#3281
seratch merged 1 commit intoopenai:mainfrom
Aphroq:fix/guardrail-exception-cleanup

Conversation

@Aphroq
Copy link
Copy Markdown
Contributor

@Aphroq Aphroq commented May 8, 2026

Summary

This pull request fixes two streaming guardrail exception handling paths:

  • re-raises ordinary output guardrail exceptions from _run_output_guardrails_for_stream() instead of logging and treating them as no guardrail results
  • awaits cancelled sibling tasks in run_input_guardrails_with_queue() before re-raising ordinary exceptions or cancellation

Test plan

  • uv run pytest tests/test_guardrails.py -k "streaming_input_guardrail_exception_awaits_cancelled_siblings"
  • uv run pytest tests/test_agent_runner_streamed.py -k "output_guardrail_exception_raises_from_run_loop_task_before_stream_consumption"
  • uv run pytest tests/test_guardrails.py tests/test_agent_runner_streamed.py -k "guardrail"
  • bash .agents/skills/code-change-verification/scripts/run.sh

Issue number

Closes #3280

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

@Aphroq Aphroq changed the title Fix streaming guardrail exception cleanup fix: #3280 streaming guardrail exception cleanup May 8, 2026
@seratch seratch added this to the 0.17.x milestone May 8, 2026
@seratch seratch merged commit 4a3d33e into openai:main May 8, 2026
10 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.

Streaming guardrail exceptions can be swallowed or leave cancelled siblings unawaited

2 participants