Skip to content

Python: preserve server RUN_ERROR code in AG-UI event conversion - #9772

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

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

Conversation

@Dhruv-Sh-git

@Dhruv-Sh-git Dhruv Shaswat (Dhruv-Sh-git) commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #8828

Summary

When AGUIEventConverter converted a RUN_ERROR event, it hard-coded error_code="RUN_ERROR", discarding any specific error code emitted by the server, such as APPROVAL_INVOCATION_DISABLED, APPROVAL_RESUME_INVALID, or TimeoutError.
This PR preserves the event's code field when present and falls back to "RUN_ERROR" when it is missing. This allows AGUIChatClient callers to inspect and handle specific error types.

Changes

  • packages/ag-ui/agent_framework_ag_ui/_event_converters.py: Preserve the event's code field, falling back to "RUN_ERROR" when absent.
  • packages/ag-ui/tests/ag_ui/test_event_converters.py: Add a regression test verifying that specific error codes are preserved.
  • packages/ag-ui/tests/ag_ui/test_ag_ui_client.py: Add a streaming regression test verifying that the preserved error code is propagated in client updates.

Validation

  • Ruff checks passed.
  • All 1,695 tests passed in packages/ag-ui.

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.

@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 (1 commit(s)): e3420f5b623f
Model: gpt-5.6-sol

Overview

The change preserves meaningful server-provided RUN_ERROR.code values while retaining the existing "RUN_ERROR" fallback for events without a usable code. Direct converter and streaming client tests cover both the fallback and specific-code propagation, and the existing partial-tool invalidation path still intercepts terminal errors before conversion. No publishable Critical, High, or Medium issue 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.

@agent-framework-automation

Copy link
Copy Markdown

Dhruv Shaswat (@Dhruv-Sh-git), this pull request is waiting on your response. If there is no further activity within 4 days, it will be closed automatically. (This is an automated message.)

@agent-framework-automation agent-framework-automation Bot added the requested-info Information or updates are needed from the author; inactive PRs may be closed automatically. label Nov 4, 2026

This branch was previously deployed

1 inactive deployment
github-app-auth — e3420f5b Deployed Oct 27, 2026 by Dhruv-Sh-git via add_label #26351
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 requested-info Information or updates are needed from the author; inactive PRs may be closed automatically.

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