Skip to content

Python: Sanitize workflow error messages - #8368

Merged
Evan Mattson (moonbox3) merged 3 commits into
microsoft:mainfrom
jpalvarezl:fix/python-workflow-error-handling
Sep 15, 2026
Merged

Evan Mattson (moonbox3) merged 3 commits into
microsoft:mainfrom
jpalvarezl:fix/python-workflow-error-handling

Conversation

@jpalvarezl

Copy link
Copy Markdown
Member

Motivation & Context

Keep internal workflow diagnostics separate from client-facing AG-UI error messages while retaining useful error codes and server-side troubleshooting information.

Description & Review Guide

  • What are the major changes?
    • Use a consistent public message for workflow failures and preserve their error codes.
    • Limit executor-failure activity details to the public message and error type; log internal messages and tracebacks server-side.
    • Remove response-body previews from declarative HTTP action exceptions while retaining request URL and status diagnostics.
    • Extend existing tests with serialization regressions and successful-response controls. Follow the existing function-local optional-import pattern for the cross-package test; no dependency or lockfile changes.
  • What is the impact of these changes?
    • Client-facing workflow errors no longer include internal exception text, tracebacks, or extra diagnostic fields.
    • Successful workflow output, cancellation, and resume validation behavior are unchanged.
  • What do you want reviewers to focus on?
    • Consistent error handling across run-error and executor-failure events, preservation of error codes and server diagnostics, and the regression controls.

Related Issue

N/A.

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.

Keep workflow diagnostics server-side while preserving public error codes. Remove HTTP response body previews from declarative action exceptions and cover serialized workflow errors with regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 14, 2026 11:08
@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Sep 14, 2026

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.

🟡 Changes recommended

Real executor failures currently produce three duplicate traceback logs, increasing alert noise and ingestion volume.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Sanitizes client-facing workflow errors while preserving server-side diagnostics and error codes.

Changes:

  • Replaces internal AG-UI error details with a consistent public message.
  • Removes HTTP response bodies from declarative action exceptions.
  • Adds serialization, logging, and success-path regression tests.
File summaries
File Description
python/packages/declarative/tests/test_http_request_executor.py Tests body sanitization and AG-UI serialization.
python/packages/declarative/agent_framework_declarative/_workflows/_executors_http.py Removes response-body previews from errors.
python/packages/ag-ui/tests/ag_ui/test_workflow_run.py Tests sanitized workflow and executor failures.
python/packages/ag-ui/tests/ag_ui/golden/test_scenario_workflow.py Validates real executor failure behavior.
python/packages/ag-ui/agent_framework_ag_ui/_workflow_run.py Sanitizes public errors and logs internal diagnostics.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Balanced (auto)

Note

Copilot is running an experiment and ran this review at Balanced.


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

Comment thread python/packages/ag-ui/agent_framework_ag_ui/_workflow_run.py Outdated

@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)): 2e673a81ecc5
Model: gpt-5.6-sol-fast

Overview

The PR consistently replaces client-facing workflow failure details with a generic message while preserving error codes and server-side diagnostics, and removes declarative HTTP response bodies from non-success exceptions. Structured, unexpected-stream, real-executor, and cross-package serialization tests cover the principal disclosure paths while retaining successful-response, cancellation, and response-header behavior. The review found no supported Critical, High, or Medium defect.

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.

Prefer one complete exception traceback when a workflow emits failure events and then re-raises. Retain a single structured diagnostic when no exception follows or the stream is closed early.

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

Copy link
Copy Markdown
Member

Thanks for the update. Before this is ready, could you please:

  • get the non-green checks passing: merge-gatekeeper (FAILURE), python-tests-coverage (FAILURE), Python Tests (3.10, ubuntu-latest) (CANCELLED), Python Tests (3.10, windows-latest) (CANCELLED), Python Tests (3.11, windows-latest) (CANCELLED), Python Tests (3.12, ubuntu-latest) (CANCELLED), Python Tests (3.12, windows-latest) (CANCELLED), Python Tests (3.13, ubuntu-latest) (FAILURE), Python Tests (3.13, windows-latest) (CANCELLED), Python Tests (3.14, windows-latest) (CANCELLED)

Once those are addressed, please re-request review. Thanks!

@moonbox3
Evan Mattson (moonbox3) added this pull request to the merge queue Sep 15, 2026
Merged via the queue into microsoft:main with commit 8728837 Sep 15, 2026
40 checks passed
@jpalvarezl
Jose Alvarez (jpalvarezl) deleted the fix/python-workflow-error-handling branch September 15, 2026 08:17
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.

4 participants