Skip to content

fix(pydantic-ai): preserve unshaped message fields - #947

Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit into
mainfrom
abhi/simplify-pydantic-shaping-64ae3725
Oct 16, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 1 commit into
mainfrom
abhi/simplify-pydantic-shaping-64ae3725

Conversation

@AbhiPrasad

Copy link
Copy Markdown
Member

Summary

  • Pass raw conversation messages to _shape_messages; core serialization now preserves nested dataclass parts.
  • Reshape messages only when binary content needs materializing, preserving fields added by newer pydantic_ai versions.
  • Add coverage comparing serialized raw and adapter-dumped request/response messages, including system, user, text, and tool-call parts.

Logged shape

Known fields retain the same structure. Prompt-bearing messages without binary content can now include newer pydantic_ai fields that the previous allowlist dropped. The raw-versus-dumped comparison found matching keys and values; key order may differ.

Validation

  • nox -s 'test_pydantic_ai_integration(latest)' -- -k 'shape_message_and_response_pass_through_when_no_binary or conversation_messages_serialize_same_with_or_without_adapter_dump' — 2 passed.
  • nox -s 'test_pydantic_ai_integration(latest)' -- -k 'test_agent_with_conversation' --vcr-record=none — 5 passed.
  • No cassettes re-recorded.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T23:53:40.663583Z 8d53681 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit 04d3dfc into main Oct 16, 2026
193 of 195 checks passed
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) deleted the abhi/simplify-pydantic-shaping-64ae3725 branch October 16, 2026 00:13
@AbhiPrasad

Copy link
Copy Markdown
Member Author

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.

1 participant