Skip to content

Python: Recommend include_detailed_errors in the tool-failure warning only when it is disabled - #9472

Open
Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
microsoft:mainfrom
ShivamSharma43:fix/9439-detailed-errors-warning
Open

Shivam Sharma (ShivamSharma43) wants to merge 1 commit into
microsoft:mainfrom
ShivamSharma43:fix/9439-detailed-errors-warning

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Motivation & Context

When a tool raises, _function_execution_error_result logs a warning ending in "Set include_detailed_errors=True for the full detail." It does that in both branches regardless of the configuration, so a caller who already set include_detailed_errors=True is told to turn on a setting that is on, which reads as if the configuration was ignored.

Description & Review Guide

  • What are the major changes? _function_execution_error_result reads include_detailed_errors once and appends the recommendation to the warning only when it is disabled. The rest of the warning, the sensitive-data branch (which still adds Exception: %r only when sensitive data is enabled), and the model-bound result are unchanged.
  • What is the impact of these changes? With include_detailed_errors=False (the default) the warning is identical to today. With it enabled, the warning reads "Function '' raised an exception; returning an error result to the model." with no recommendation. Only the log text changes; no function-calling loop behavior changes.
  • What do you want reviewers to focus on? Nothing beyond the warning text.

Tests: the existing test_function_invocation_result_parser_failure (which already parametrizes include_detailed_errors, streaming and sensitive data) now also asserts the recommendation appears only when detailed errors are disabled, and the new test_function_execution_error_warning_recommends_detailed_errors_only_when_disabled covers a raising tool across the sensitive-data settings. The include_detailed_errors=True cases of both fail without the change.

Related Issue

Fixes #9439

No open PR references this issue.

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: implementation, tests and this PR description were drafted with Claude Code and reviewed before submitting.

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. 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.

🤖 Generated with Claude Code

The tool-failure warning always told callers to set
include_detailed_errors=True, even when it was already enabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Oct 17, 2026

This branch was successfully deployed

1 active deployment
github-app-auth — a409cce1 Deployed Oct 17, 2026 by ShivamSharma43 via team_check #6975
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]: Tool-failure warning recommends  include_detailed_errors=True  even when already enabled

2 participants