Repository navigation
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
Conversation
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>
Shivam Sharma (ShivamSharma43)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 17, 2026 17:28
Shivam Sharma (ShivamSharma43)
deployed
to
github-app-auth
October 17, 2026 17:28 — with
GitHub Actions
Active
Shivam Sharma (ShivamSharma43)
deployed
to
github-app-auth
October 17, 2026 17:28 — with
GitHub Actions
Active
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
When a tool raises,
_function_execution_error_resultlogs 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 setinclude_detailed_errors=Trueis told to turn on a setting that is on, which reads as if the configuration was ignored.Description & Review Guide
_function_execution_error_resultreadsinclude_detailed_errorsonce and appends the recommendation to the warning only when it is disabled. The rest of the warning, the sensitive-data branch (which still addsException: %ronly when sensitive data is enabled), and the model-bound result are unchanged.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.Tests: the existing
test_function_invocation_result_parser_failure(which already parametrizesinclude_detailed_errors, streaming and sensitive data) now also asserts the recommendation appears only when detailed errors are disabled, and the newtest_function_execution_error_warning_recommends_detailed_errors_only_when_disabledcovers a raising tool across the sensitive-data settings. Theinclude_detailed_errors=Truecases of both fail without the change.Related Issue
Fixes #9439
No open PR references this issue.
AI Assistance
AI assistance details: implementation, tests and this PR description were drafted with Claude Code and reviewed before submitting.
Contribution Checklist
breaking changelabel (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