Skip to content

[codex] Include completion in ContentFilterFinishReasonError#3094

Open
yu2001-s wants to merge 2 commits intoopenai:mainfrom
yu2001-s:codex/content-filter-error-completion
Open

[codex] Include completion in ContentFilterFinishReasonError#3094
yu2001-s wants to merge 2 commits intoopenai:mainfrom
yu2001-s:codex/content-filter-error-completion

Conversation

@yu2001-s
Copy link
Copy Markdown

Fixes #2690

Summary

  • attach the triggering completion to ContentFilterFinishReasonError, mirroring LengthFinishReasonError
  • preserve completion details when chat completion parsing fails on content_filter in both the direct parse path and streaming path
  • add regression coverage for the non-streaming parser and streaming completion state helper

Testing

  • uv run pytest tests/lib/chat/test_completions.py -k "content_filter or max_tokens_reached" -n 0
  • uv run pytest tests/lib/chat/test_completions_streaming.py -k "content_filter or max_tokens_reached" -n 0
  • uv run ruff check src/openai/_exceptions.py src/openai/lib/_parsing/_completions.py src/openai/lib/streaming/chat/_completions.py tests/lib/chat/test_completions.py tests/lib/chat/test_completions_streaming.py

@yu2001-s yu2001-s marked this pull request as ready for review April 16, 2026 03:03
@yu2001-s yu2001-s requested a review from a team as a code owner April 16, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Include response information in ContentFilterFinishReasonError

1 participant