Skip to content

Python: answer unsupported DevUI conversation items with a client error - #9507

Open
Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/devui-item-validation-status
Open

Manohar Paturi (ManoharPaturi) wants to merge 1 commit into
microsoft:mainfrom
ManoharPaturi:fix/devui-item-validation-status

Conversation

@ManoharPaturi

@ManoharPaturi Manohar Paturi (ManoharPaturi) commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Motivation & Context

add_items signals both a missing conversation and unsupported item content with a plain ValueError, and the route answers every ValueError with 404. Posting a video-only item to an existing conversation therefore reported Not Found, which reads as a wrong conversation id rather than a request the client can fix.

Description & Review Guide

  • What are the major changes? Unsupported item content now raises a ConversationItemValidationError (a ValueError subclass), and the items route maps it to 400 while a missing conversation stays 404.
  • What is the impact of these changes? Only the status code for the malformed item case changes. Other handlers catching ValueError are unaffected because the new exception subclasses it.
  • What do you want reviewers to focus on? The route test covers both cases against the HTTP surface: unsupported content on an existing conversation is 400, and an unknown conversation id is still 404.

Related Issue

Fixes #9506

AI Assistance

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The 400/404 exception split and route coverage are correct; only the import block needs to be made lint-clean.


from fastapi import FastAPI, HTTPException, Request

from ._conversations import ConversationItemValidationError

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please move this relative import below the complete fastapi import group, alongside the other local imports. Ruff enables the I/isort rules, so placing it between from fastapi import ... and from fastapi.middleware... leaves this file with an unsorted import block and will fail code quality.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Moved: the conversations import now sits with the other local imports below the complete fastapi group, and ruff isort reports the block clean. Amended into the branch; the server suite still passes (51 tests).

@ManoharPaturi

Copy link
Copy Markdown
Contributor Author

Thanks Eduard van Valkenburg (@eavanvalkenburg). I cleaned up the import block in _server.py so ConversationItemValidationError sits properly with the local package imports rather than interrupting the FastAPI group, and verified the file passes Ruff checks.

@ManoharPaturi

Copy link
Copy Markdown
Contributor Author

The Public API Compatibility check fails on every open PR in this repo right now (e.g. #9602, #9607, and all of this author's open PRs), so it looks like a repo-wide CI issue rather than something introduced by this change.

The job crashes inside griffe while loading the base (main) snapshot, before it compares the PR changes — the traceback points at the base copy of the package:

griffe._internal.exceptions.AliasResolutionError: Could not resolve alias
agent_framework._workflows._edge.EdgeGroup.builtin_type pointing at builtins.type
(in /tmp/python-api-base-.../python/packages/core/agent_framework/_workflows/_edge.py:315)

Example run: https://github.com/microsoft/agent-framework/actions/runs/39810016173/job/119933441343

None of the changes in this PR touch _workflows/_edge.py. Filed an issue for the CI failure; happy to help debug if useful.

Signed-off-by: Manohar Paturi <186662190+ManoharPaturi@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
github-app-auth — de4ed7b3 Deployed Oct 24, 2026 by ManoharPaturi via add_label #26089
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.

Python: DevUI returns 404 for unsupported conversation item content on an existing conversation

2 participants