Skip to content

Python: Preserve server error codes in AG-UI RUN_ERROR events - #10198

Open
Dhruv Shaswat (Dhruv-Sh-git) wants to merge 5 commits into
microsoft:mainfrom
Dhruv-Sh-git:fix/issue-8828
Open

Dhruv Shaswat (Dhruv-Sh-git) wants to merge 5 commits into
microsoft:mainfrom
Dhruv-Sh-git:fix/issue-8828

Conversation

@Dhruv-Sh-git

@Dhruv-Sh-git Dhruv Shaswat (Dhruv-Sh-git) commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Motivation & Context

AGUIChatClient was replacing the specific error codes sent by the AG-UI server with a generic "RUN_ERROR" code. This made it difficult for Python clients to identify the actual failure and decide whether an operation should be retried, resumed, or abandoned.

This change preserves the original error code provided by the server while maintaining "RUN_ERROR" as the fallback when no code is available.

Description & Review Guide

  • What are the major changes?

    • Updated AGUIEventConverter._handle_run_error to use the error code supplied in the incoming event.
    • Retained "RUN_ERROR" as the default when the event does not contain a meaningful error code.
    • Added regression tests covering error-code preservation and fallback behavior.
  • What is the impact of these changes?

    • AGUIChatClient now exposes the actual server-side error codes to Python callers.
    • Applications can distinguish between different failure scenarios and handle retries or workflow resumptions appropriately.
    • Existing behavior remains unchanged for events without a specific error code.
  • What do you want reviewers to focus on?

    • Verify that server-provided error codes are preserved correctly.
    • Check that missing or empty error codes still fall back to "RUN_ERROR".
    • Ensure the existing error message and event conversion behavior remain unaffected.

Related Issue

Fixes #8828

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.

AI assistance details:

AI assistance was used to help with implementation guidance, regression test development, and preparation of the pull request description. I reviewed and verified the changes and take responsibility for the contribution.

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 links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change.

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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Nov 9, 2026
@github-actions github-actions Bot changed the title Fix issue #8828 Python: Fix issue #8828 Nov 9, 2026
@eavanvalkenburg

Copy link
Copy Markdown
Member

/review

@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: No findings
Scope: full PR (2 commit(s)): e3420f5b623f, f2da18bdfc00
Model: gpt-5.6-sol

Overview

The change preserves an optional server-provided AG-UI RUN_ERROR code while retaining the existing RUN_ERROR fallback when no meaningful code is supplied. The protocol schema constrains the field to an optional string, both streaming and non-streaming responses use the same converter path, and focused converter and client tests cover the new behavior. No Critical, High, or Medium defect was established.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

@eavanvalkenburg

Copy link
Copy Markdown
Member

Dhruv Shaswat (@Dhruv-Sh-git), the AG-UI change itself looks focused and #8828 is already ready-for-implementation, but this head also commits a roughly 127 KB ci_log.txt runner log at the repository root. Please remove that transient artifact. Also update the PR description to link the issue with a closing reference such as Fixes #8828 and complete the required Contribution Checklist. The missing AI Assistance checkbox alone is not a blocker.

@eavanvalkenburg

Copy link
Copy Markdown
Member

Dhruv Shaswat (@Dhruv-Sh-git) Thanks for the update. Issue #8828 is open and has ready-for-implementation, but the PR title and description need to follow the repository conventions before review. Please replace the generic title Python: Fix issue #8828 with a concise description of the behavior change, and rewrite the body using .github/pull_request_template.md. In the Related Issue section, use Fixes #8828; describe the motivation, major changes, impact and review focus; complete the AI Assistance section; and update the contribution checklist accurately.

@Dhruv-Sh-git Dhruv Shaswat (Dhruv-Sh-git) changed the title Python: Fix issue #8828 Python: Preserve server error codes in AG-UI RUN_ERROR events Nov 11, 2026

This branch was successfully deployed

1 active deployment
github-app-auth — fc108f3d Deployed Nov 12, 2026 by Dhruv-Sh-git via add_label #27701
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: [Bug]: AGUIChatClient replaces the server's RUN_ERROR code with a generic "RUN_ERROR"

3 participants