Skip to content

Python: DevUI, Fix message serialization issue, improve tests #2674

Merged
victordibia merged 3 commits intomainfrom
devui_bugfix
Dec 6, 2025
Merged

Python: DevUI, Fix message serialization issue, improve tests #2674
victordibia merged 3 commits intomainfrom
devui_bugfix

Conversation

@victordibia
Copy link
Contributor

@victordibia victordibia commented Dec 5, 2025

Motivation and Context

Python: DevUI, Fix message serialization issue, improve tests .
Thanks @pamelafox

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@markwallace-microsoft
Copy link
Member

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
TOTAL16230254084% 
report-only-changed-files is enabled. No files were changed during this commit :)

Python Unit Test Overview

Tests Skipped Failures Errors Time
2322 130 💤 0 ❌ 0 🔥 58.916s ⏱️

@victordibia victordibia marked this pull request as ready for review December 6, 2025 00:45
Copilot AI review requested due to automatic review settings December 6, 2025 00:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical message serialization bug in the Python DevUI package and significantly improves test coverage. The main issue was that ExecutorCompletedEvent.data could contain nested non-JSON-serializable objects (AgentExecutorResponse with AgentRunResponse and ChatMessage), which caused serialization failures when events were sent over Server-Sent Events (SSE).

Key Changes:

  • Fixed serialization of ExecutorCompletedEvent by calling _serialize_value() on the result data before including it in the event
  • Corrected ExecutorFailedEvent to use the details field instead of error field
  • Added comprehensive regression tests using real agent_framework classes (not mocks) to ensure proper serialization
  • Removed test skips and improved test organization with a new test_helpers.py module

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
python/packages/devui/agent_framework_devui/_mapper.py Core serialization fix: calls _serialize_value() on ExecutorCompletedEvent.data; corrects field access for ExecutorFailedEvent from 'error' to 'details'
python/packages/devui/agent_framework_devui/_server.py Improves error logging by adding exc_info=True for better debugging context
python/packages/devui/tests/test_mapper.py Major refactoring with new comprehensive tests for serialization, executor events, workflow events, and edge cases using real classes
python/packages/devui/tests/test_helpers.py New file providing reusable test utilities including mock clients, agents, and factory functions for test data
python/packages/devui/tests/test_execution.py Extensive improvements with full pipeline tests, workflow execution tests, and proper fixtures using real ChatAgent with mock LLM
python/packages/devui/tests/test_server.py Unskipped test and improved assertions for entity discovery
python/packages/devui/tests/test_discovery.py Unskipped agent discovery test
python/packages/devui/tests/test_cleanup_hooks.py Fixed field name from content to contents to match API
python/packages/devui/pyproject.toml Added pythonpath configuration for test discovery

@victordibia victordibia added this pull request to the merge queue Dec 6, 2025
Merged via the queue into main with commit 8c6b12e Dec 6, 2025
29 checks passed
@victordibia victordibia deleted the devui_bugfix branch December 8, 2025 18:27
arisng pushed a commit to arisng/agent-framework that referenced this pull request Feb 2, 2026
…oft#2674)

* fix message serialization issue, improve tests for devui

* update tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants