Skip to content

Python: fix: write enum value in annotation XML type attribute - #14593

Open
CRYPTONIKAV wants to merge 1 commit into
microsoft:mainfrom
CRYPTONIKAV:fix/14590-annotation-enum-value
Open

CRYPTONIKAV wants to merge 1 commit into
microsoft:mainfrom
CRYPTONIKAV:fix/14590-annotation-enum-value

Conversation

@CRYPTONIKAV

Copy link
Copy Markdown

Closes #14590

What I changed

  • python/semantic_kernel/contents/annotation_content.py + streaming_annotation_content.py: to_element() now writes self.citation_type.value instead of the enum object (which serialized as CitationType.FILE_CITATION and broke from_element round trips through rendered prompts).
  • Tests: serialized-XML round trips (tostring → fromstring → from_element) for both classes. The existing in-memory round trips never caught this because the enum survived without serialization.

Verification

  • New tests fail on main, pass with the fix (RED→GREEN); contents suite green, ruff check clean

@CRYPTONIKAV
CRYPTONIKAV requested a review from a team as a code owner October 13, 2026 23:09
Copilot AI balanced review requested due to automatic review settings October 13, 2026 23:09
@semantic-kernel-automation semantic-kernel-automation Bot added the python Pull requests for the Python Semantic Kernel label Oct 13, 2026
@github-actions github-actions Bot changed the title fix: write enum value in annotation XML type attribute Python: fix: write enum value in annotation XML type attribute Oct 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused fix correctly addresses the reported serialization failure with regression coverage for both affected classes.

0 open findings

What changed in this PR

Fixes XML serialization of citation types so annotation content can round-trip through rendered prompts.

Changes:

  • Serializes CitationType.value in XML attributes.
  • Adds serialized-XML round-trip tests for both annotation classes.
File Description
python/​semantic_kernel/​contents/​annotation_content.py Writes valid citation type values to XML.
python/​semantic_kernel/​contents/​streaming_annotation_content.py Applies the same fix to streaming annotations.
python/​tests/​unit/​contents/​test_annotation_content.py Tests serialized XML round-tripping.
python/​tests/​unit/​contents/​test_streaming_annotation_content.py Tests streaming annotation round-tripping.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@CRYPTONIKAV

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

This branch was previously deployed

1 inactive deployment
github-app-auth — 5ceeae2f Deployed Oct 13, 2026 by CRYPTONIKAV via team_check #618
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: Bug: AnnotationContent and StreamingAnnotationContent to_element writes CitationType.X, so annotations in a rendered chat history fail to parse

2 participants