Skip to content

Python: Align DevUI Responses parsing - #7968

Merged
Eduard van Valkenburg (eavanvalkenburg) merged 4 commits into
microsoft:mainfrom
eavanvalkenburg:eavanvalkenburg-devui-parser-alignment
Sep 1, 2026
Merged

Python: Align DevUI Responses parsing#7968
Eduard van Valkenburg (eavanvalkenburg) merged 4 commits into
microsoft:mainfrom
eavanvalkenburg:eavanvalkenburg-devui-parser-alignment

Conversation

@eavanvalkenburg

Copy link
Copy Markdown
Member

Motivation & Context

DevUI's local Responses API conversion could flatten multiple input messages into one user message, drop conversation content after the first part, and replace unsupported input with an empty user text message. Completion conversion also estimated token usage from character counts and generated unrelated response IDs during one streamed lifecycle. These mismatches make local agent behavior diverge from the OpenAI Responses contract and lose information needed by multimodal and conversation scenarios.

Description & Review Guide

  • What are the major changes? Preserve supported input message roles, boundaries, text/image/file parts, hosted file IDs, image detail, and straightforward canonical MIME types across executor and conversation conversion. Reject unsupported-only message input explicitly. Reuse the server tracking ID through lifecycle and final aggregation, and omit usage when the framework did not report it.
  • What is the impact of these changes? Local DevUI execution and conversation APIs retain supported Responses input semantics instead of silently flattening or fabricating content. Completed responses expose only measured usage, and streamed response IDs remain stable.
  • What do you want reviewers to focus on? Please focus on the deliberately narrow supported-part boundary: message text, images, and files are preserved without adding a shared codec or expanding support to unrelated top-level Responses item types.

Related Issue

N/A — follow-up from the Responses conversion consistency sweep

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Aligns DevUI’s local Responses conversion with OpenAI semantics while preserving multimodal content and response metadata.

Changes:

  • Preserves message roles, boundaries, images, files, MIME types, and hosted IDs.
  • Stabilizes response IDs and removes estimated token usage.
  • Rejects unsupported-only inputs and expands conversion tests.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
_executor.py Expands Responses input conversion.
_conversations.py Preserves supported conversation parts.
_mapper.py Stabilizes IDs and usage handling.
test_multimodal_workflow.py Tests multimodal input conversion.
test_mapper.py Tests IDs and missing usage.
test_conversations.py Tests conversation round-tripping.
test_approval_validation.py Updates rejection expectations.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread python/packages/devui/agent_framework_devui/_mapper.py Outdated
Comment thread python/packages/devui/agent_framework_devui/_executor.py
@github-actions

github-actions Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

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

Python Unit Test Overview

Tests Skipped Failures Errors Time
9858 36 💤 0 ❌ 0 🔥 2m 44s ⏱️

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

MAF Automated Review — Iteration 1

Result: Findings reported
Scope: full PR (1 commit(s)): 3294e694cb22
Model: gpt-5.6-sol

Overview

The change substantially improves preservation of Responses message boundaries, multimodal content, stable response IDs, and measured usage, with focused regression coverage for the intended conversions. Validation of roles, server-side approval reconstruction, atomic conversation mutation, and mapper cleanup provide useful guardrails. Two lifecycle gaps remain: failed streams are finalized with a contradictory completion event, and unsupported-only messages can still disappear when another valid message is present.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
2 verified findings remained after source verification (1 high, 1 medium) across 2 files. Details are attached to the affected lines below.

Affected areas: python/packages/devui/agent_framework_devui/_executor.py, python/packages/devui/agent_framework_devui/_mapper.py

Comment thread python/packages/devui/agent_framework_devui/_mapper.py Outdated
Comment thread python/packages/devui/agent_framework_devui/_executor.py Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

MAF Automated Review — Iteration 2

Result: Findings reported
Scope: 1 net-new commit(s): 5dfaef081c2a
Model: gpt-5.6-sol

Overview

This iteration correctly recognizes assistant text variants, rejects each unsupported-only message, preserves partial output on failed streams, and emits one terminal event with a stable response ID. The accompanying tests cover the principal message and stream regressions. One approval-lifecycle edge case remains: validating a batch can consume a pending approval before a later message causes conversion to fail.

Reviewed the supplied incremental change set across correctness, security/reliability, architecture, and failure behavior.
1 verified finding remained after source verification (1 medium) across 1 file. Details are attached to the affected lines below.

Affected areas: python/packages/devui/agent_framework_devui/_executor.py

Comment thread python/packages/devui/agent_framework_devui/_executor.py
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Comment thread python/packages/devui/agent_framework_devui/_conversations.py Outdated
Comment thread python/packages/devui/agent_framework_devui/_executor.py
Comment thread python/packages/devui/agent_framework_devui/_mapper.py
Comment thread python/packages/devui/agent_framework_devui/_server.py Outdated
Comment thread python/packages/devui/agent_framework_devui/_conversations.py Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 832e81b1-76ee-47ca-981f-be365d987336
Merged via the queue into microsoft:main with commit e2f7db2 Sep 1, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants