Repository navigation
Python: fix(core): forward annotations and metadata in Content.from_dict raw-data path - #8668
Closed
Sehastrajit (Sehastrajit-S) wants to merge 1 commit into
Closed
Sehastrajit (Sehastrajit-S) wants to merge 1 commit into
Sehastrajit (Sehastrajit-S) wants to merge 1 commit into
Conversation
…data path Content.from_dict popped annotations, additional_properties, and raw_representation off the input mapping but never passed them to from_data() when handling raw-data content, silently dropping them. from_data() already accepts all three as keyword arguments, so this just forwards what was already extracted. Fixes microsoft#8632
Sehastrajit (Sehastrajit-S)
temporarily deployed
to
github-app-auth
September 23, 2026 04:40 — with
GitHub Actions
Inactive
Sehastrajit (Sehastrajit-S)
temporarily deployed
to
github-app-auth
September 23, 2026 04:41 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The focused fix has regression coverage and no unresolved issues.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes metadata loss when parsing raw-data content through Content.from_dict and Message.
Changes:
- Forwards annotations, additional properties, and raw representations to
Content.from_data. - Adds regression coverage for both parsing paths.
| File | Description |
|---|---|
python/packages/core/tests/core/test_types.py |
Tests metadata preservation across both parsing paths. |
python/packages/core/agent_framework/_types.py |
Preserves metadata during raw-data deserialization. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Author
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Content.from_dictpoppedannotations,additional_properties, andraw_representationoff the input mapping but never passed them through tofrom_data()when handling raw-data content, silently dropping them.from_data()already accepts all three as keyword arguments, so this change just forwards whatfrom_dicthad already extracted.Test plan
test_content_from_dict_data_preserves_metadatacovering both theContent.from_dictandMessage(...)parsing paths from the issue reprouv run poe test -P core(5642 passed)uv run poe syntax -P core(format + lint clean)uv run poe pyright -P core(0 errors)