Files
agent-framework/python/packages
T
Evan Mattson f74bda5a83 Python: Fix conversation-id propagation when chat_options is a dict (#4340)
* Fix #4305: Handle dict chat_options in _update_conversation_id

_update_conversation_id assumed chat_options had attribute access, but
ChatOptions is a TypedDict (dict). When a dict was passed, setting
.conversation_id raised AttributeError. Now checks isinstance(dict) and
uses key access for dicts, falling back to attribute access for objects.

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

* Address PR feedback: use Mapping ABC and add missing tests (#4305)

- Use collections.abc.Mapping instead of dict for isinstance check in
  _update_conversation_id, making it more robust for non-dict mapping types.
- Add test for object-style chat_options with optional options dict parameter.
- Add test verifying existing conversation_id gets overwritten (idempotent).

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

* Remove unnecessary Mapping check in _update_conversation_id (#4305)

chat_options is always a dict, so the isinstance(chat_opts, Mapping)
check and the else branch for attribute-style access are dead code.
Simplify to direct dict key assignment and remove object-style tests.

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

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f74bda5a83 ยท 2026-03-09 10:56:57 +00:00
History
..