fix: redact JSON validation errors - #4211
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ab134a0d6d
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5af632d742
ℹ️ 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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19c596ab7e
ℹ️ 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".
| message_item = ( | ||
| create_message_output_item( | ||
| public_agent, | ||
| format_final_output_text(public_agent, final_output), |
There was a problem hiding this comment.
Suppress fallback serialization warnings in redacted mode
When an invalid_final_output handler returns a fallback accepted by a permissive schema such as a Pydantic SkipValidation field and include_in_history remains true, the initial validation serialization suppresses warnings via data_redacted, but this second serialization calls format_final_output_text() with the default warnings="warn". Pydantic serializer warnings include the unexpected fallback value's representation, so a handler-derived model payload can still be written to stderr while DONT_LOG_MODEL_DATA is enabled; propagate the redaction policy into this formatting step as well.
AGENTS.md reference: AGENTS.md:L95-L95
Useful? React with 👍 / 👎.
This pull request fixes issue #4207 by redacting model-generated JSON validation failures according to the applicable model and tool data logging policies. Structured outputs use the model-data policy, while normal and Realtime handoffs require both model and tool data disclosure to be enabled before detailed diagnostics are retained.
It also removes sensitive payloads from exception chains and SDK traceback frames across Runner and Realtime synchronous, asynchronous, and shutdown paths, and ensures tracing failures cannot replace the safe redacted error.
This pull request resolves #4207.