GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — chore(openai-agents): Use `model_dump()` instead of deprecated `dict()` by intertermux-code · Pull Request #7862 · getsentry/sentry-python

Conversation

@intertermux-code

@intertermux-code intertermux-code commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Resubmitting as a single-change PR per your feedback on #7857.

Description

_set_output_data in the OpenAI Agents integration (and _set_common_output_data in the OpenAI integration's Responses API path) serialized pydantic models with the v1 .dict() API. On pydantic v2 that emits PydanticDeprecatedSince20, which breaks anyone running with DeprecationWarnings as errors.

Every supported openai/openai-agents version requires pydantic v2, so .model_dump() is a drop-in replacement. The OpenAI integration already calls .model_dump() unconditionally a few lines above (chat completions path), and the Anthropic/LiteLLM integrations use the same pattern.

Changed:

  • sentry_sdk/integrations/openai_agents/utils.py: 2 calls
  • sentry_sdk/integrations/openai.py: 4 calls (both record-outputs branches of the Responses API path)

Added test_set_output_data_tool_calls_no_pydantic_deprecation, which runs _set_output_data with a function call plus a message carrying non-text content (the refusal path) under warnings.simplefilter("error", DeprecationWarning).

Issues

  • resolves: OpenAI Agents integration emits PydanticDeprecatedSince20 on tool calls - _set_output_data calls dict() #7827

Reminders

  • Please add tests to validate your changes, and lint your code using uv run ruff.
  • Add GH Issue ID & Linear ID (if applicable)
  • PR title should use conventional commit style (feat:, fix:, meta:)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@intertermux-code
fix: use model_dump() instead of deprecated dict() in OpenAI output p…
8012ab8
…aths

The pydantic v1 .dict() API emits PydanticDeprecatedSince20 on
pydantic v2, which breaks anyone running with DeprecationWarnings as
errors. Every supported openai/openai-agents version requires
pydantic v2, so model_dump() is a drop-in replacement here.

Fixes getsentry#7827.
@intertermux-code
intertermux-code requested a review from a team as a code owner October 5, 2026 08:58
alexander-alderman-webb
alexander-alderman-webb requested changes Oct 5, 2026
View reviewed changes
Comment thread tests/integrations/openai_agents/test_openai_agents.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@intertermux-code
test: drop redundant pydantic deprecation regression test
90324f1
Maintainer feedback: the new test duplicates coverage already provided
by the existing suite, so it is not needed. The fix itself (model_dump()
instead of dict()) is unchanged.
@alexander-alderman-webb

alexander-alderman-webb commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

This doesn't actually work because you can use openai-python with Pydantic v1, in which model_dump() is not available. See https://github.com/openai/openai-python/blob/becc1d20eed83c1b8d85e15dc131a372d9dc7813/pyproject.toml#L13.

I'm going to close this and write on the issue.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-alderman-webb alexander-alderman-webb closed this Oct 5, 2026
@alexander-alderman-webb alexander-alderman-webb reopened this Oct 5, 2026
@alexander-alderman-webb

alexander-alderman-webb commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Or @intertermux-code feel free to apply the fix only for openai-agents.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@intertermux-code
fix: scope model_dump() migration to the openai-agents integration
4496cf4
openai-python supports Pydantic v1 (where model_dump() doesn't exist), so
revert the .dict() -> model_dump() change in the openai-python integration
and keep it only in sentry_sdk/integrations/openai_agents/utils.py, where
the openai-agents SDK guarantees Pydantic v2.

Also fold the test import back to a single line; the multi-line form was
only needed for the removed regression test's extra import.
@intertermux-code

intertermux-code commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Good catch — scoped it down to the openai-agents integration only and reverted the openai-python changes, since openai-python still supports Pydantic v1 where model_dump() doesn't exist. The openai-agents path keeps model_dump() (Pydantic v2 is guaranteed there).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

alexander-alderman-webb
alexander-alderman-webb reviewed Oct 5, 2026
View reviewed changes
Comment thread sentry_sdk/integrations/openai.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@intertermux-code
fix(openai): revert incidental formatting-only change
7450535
Restores the original multi-line form around output_message.dict(); no
behavioral change. The model_dump() migration now applies only to the
openai-agents integration, per review.
alexander-alderman-webb
alexander-alderman-webb approved these changes Oct 5, 2026
View reviewed changes
@alexander-alderman-webb alexander-alderman-webb changed the title fix: use model_dump() instead of deprecated dict() in OpenAI output paths chore(openai-agents): Use model_dump() instead of deprecated dict() Oct 5, 2026
@alexander-alderman-webb
alexander-alderman-webb merged commit c5f80df into getsentry:master Oct 5, 2026
309 of 311 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@intertermux-code
intertermux-code deleted the fix/7827-pydantic-deprecated branch October 9, 2026 01:29
@sentry-release-bot sentry-release-bot Bot mentioned this pull request Oct 12, 2026
publish: getsentry/[email protected] getsentry/publish#9830
Closed
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@alexander-alderman-webb alexander-alderman-webb alexander-alderman-webb approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

OpenAI Agents integration emits PydanticDeprecatedSince20 on tool calls - _set_output_data calls dict()

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@intertermux-code @alexander-alderman-webb
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.