Python: Preserve tool call IDs in chat history XML - #14440
Open
Gali (Jokasa7) wants to merge 1 commit into
Open
Gali (Jokasa7) wants to merge 1 commit into
Gali (Jokasa7) wants to merge 1 commit into
Conversation
Gali (Jokasa7)
had a problem deploying
to
github-app-auth
September 13, 2026 13:19 — with
GitHub Actions
Failure
Gali (Jokasa7)
had a problem deploying
to
github-app-auth
September 13, 2026 13:19 — with
GitHub Actions
Failure
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
All reviewed changes and regression coverage are complete with no unresolved blocking issues.
Pull request overview
Preserves Responses API tool-call call_id values through chat-history XML serialization and deserialization.
Changes:
- Adds XML serialization and restoration for
call_id. - Adds XML round-trip and legacy compatibility tests.
- Verifies Responses request payloads for both storage modes.
File summaries
| File | Description |
|---|---|
python/tests/unit/contents/test_chat_history.py |
Tests XML round-trip preservation and legacy behavior. |
python/tests/unit/agents/openai_responses/test_openai_responses_thread_actions.py |
Tests prepared Responses payloads. |
python/semantic_kernel/contents/function_result_content.py |
Persists function-result call_id in XML. |
python/semantic_kernel/contents/function_call_content.py |
Persists function-call call_id in XML. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Motivation and Context
Python
ChatHistory.to_prompt()/str(history)followed byChatHistory.from_rendered_prompt()dropscall_idfrom function calls and results. For Responses API content, the itemidand the tool-call correlationcall_idare distinct. After this XML round trip, the existing Responses request adapter emitscall_id=Nonefor tool outputs (and for function calls whenstore_enabled=False). The JSON round trip already preserves these fields.Description
Serialize the existing optional
call_idfield as an XML attribute inFunctionCallContentandFunctionResultContent, and read it when reconstructing each object. XML without the attribute continues to deserialize withcall_id=None. This does not change the existingidfield or introduce an ID fallback.Regression tests exercise both public XML serialization entry points, legacy content without a correlation ID, and the actual Responses request preparation for both
store_enabledmodes.Validation
pytest tests/unit/contents tests/unit/agents/openai_responses: 438 passed, with 71 existing deprecation warnings.mypy semantic_kernel: 23 errors in 6 files, identical line-for-line in a clean worktree at the original commit using the same environment. These errors are in unchanged code; this is not a claim of a clean full-package type check.Contribution Checklist
Prepared with AI assistance, including the implementation, tests, and this description. Local regression verification and an independent agent review are recorded above.