Repository navigation
Python: fix(devui): fallback to empty string when reasoning chunk has no text - #9546
Open
Hardik K (hardikkaurani) wants to merge 1 commit into
Open
Hardik K (hardikkaurani) wants to merge 1 commit into
Hardik K (hardikkaurani) wants to merge 1 commit into
Conversation
Hardik K (hardikkaurani)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 19, 2026 19:59
Hardik K (hardikkaurani)
deployed
to
github-app-auth
October 19, 2026 19:59 — with
GitHub Actions
Active
Hardik K (hardikkaurani)
deployed
to
github-app-auth
October 19, 2026 19:59 — with
GitHub Actions
Active
Author
|
Hi Vincent Biret (@baywet) westey (@westey-m), submitted this PR to address #9533 where reasoning chunks with no text content cause Pydantic validation failure in DevUI _map_reasoning_content. Added unit tests covering both None and valid text scenarios. Ready for your review, thank you! |
Comment on lines
+1192
to
+1205
| context = {"item_id": "item-1", "output_index": 0, "content_index": 0, "sequence": 0} | ||
| content = MagicMock() | ||
| content.text = None | ||
|
|
||
| event = await mapper._map_reasoning_content(content, context) | ||
| assert event.type == "response.reasoning_text.delta" | ||
| assert event.delta == "" | ||
|
|
||
|
|
||
| async def test_map_reasoning_content_with_valid_text(mapper: MessageMapper) -> None: | ||
| """Test that TextReasoningContent with valid text maps delta properly.""" | ||
| from unittest.mock import MagicMock | ||
|
|
||
| context = {"item_id": "item-1", "output_index": 0, "content_index": 0, "sequence": 0} |
There was a problem hiding this comment.
Hardik K (@hardikkaurani) can you please address this issue?
This branch was successfully 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.

Description
Fixes #9533: When running an agent with Gemini (or any client where a reasoning chunk has no text content),
content.textcan beNone. InMessageMapper._map_reasoning_content(agent_framework_devui/_mapper.py), passingdelta=content.textcauses Pydantic to raise:This PR:
delta=content.text or ""in_map_reasoning_contentto ensure valid string input forResponseReasoningTextDeltaEvent.python/packages/devui/tests/devui/test_mapper.pycovering reasoning content mapping with bothNoneand valid text.Fixes #9533
cc Vincent Biret (@baywet) westey (@westey-m)