Files
agent-framework/python/packages
T
Giles Odigwe 651e317907 Python: Fix _add_text_reasoning_content to preserve id during coalescing (#4862)
* Fix _add_text_reasoning_content dropping id during coalescing (#4852)

Preserve the id field (rs_* identifier) when coalescing text_reasoning
Content objects by passing id=self.id or other.id to the Content
constructor. This fixes the encrypted reasoning round-trip where the
missing id prevented _prepare_content_for_openai from including it in
the serialized reasoning item.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Python: Fix `_add_text_reasoning_content` to preserve `id` during coalescing

Fixes #4852

* Raise AdditionItemMismatch on conflicting text_reasoning ids (#4852)

Detect when both operands have different non-empty ids during
text_reasoning Content coalescing and raise AdditionItemMismatch
instead of silently keeping one. This prevents mis-associating
encrypted_content during round-trips.

Also adds tests for conflicting ids and the neither-has-id edge case.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review feedback for #4852: Python: [Bug]: Content._add_text_reasoning_content drops id during coalescing, breaking encrypted reasoning round-trip

* test fix

---------

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
651e317907 ยท 2026-03-31 21:58:02 +00:00
History
..