feat(engine): give the model actionable detail on a failed child-agent call - #88
Open
AmitAvital1 wants to merge 1 commit into
Conversation
…t call Stacked on #76 (fix/on-tool-error-hook-failure-crashes-run), which made a failed child-agent call recoverable instead of crashing the run but returned only a generic notice to the model. A model can only correct a call it can't read the failure of. This replaces the generic "internal error, not a problem with the arguments" notice with: - A validation failure (malformed tool args) is reworded into field-level detail via validation_problems()/_invalid_args_message() — which fields were wrong and why — without echoing the rejected arguments back into the model's context. - Any other child failure now passes its safe_error()-bounded cause through to the model (_child_failure_message()), the same contract a regular tool failure already has with its caller, instead of a generic message that gives the model nothing to act on. - _AgentCall's message field gets a description clarifying it takes a single plain-text string, reducing how often the orchestrator sends a shape that would only fail validation in the first place. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
AmitAvital1
marked this pull request as draft
August 8, 2026 07:41
AmitAvital1
marked this pull request as ready for review
August 8, 2026 09:18
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.
Stacked on #76 — please review/merge that one first.
What
#76 made a failed child-agent call recoverable instead of crashing the run, but the model only got a generic notice back (
"Agent 'X' failed to complete this request. This is an internal error, not a problem with the arguments."). A model can't correct a call it can't read the failure of.This PR replaces that generic notice with actionable detail:
validation_problems()/_invalid_args_message()into field-level detail — which fields were wrong and why — without echoing the rejected arguments back into the model's own context.safe_error()-bounded cause through to the model (_child_failure_message()) — the same contract a regular tool failure already has with its caller — instead of a message that gives the model nothing to act on._AgentCall.messagegets a schema description clarifying it's a single plain-text string, reducing how often the orchestrator sends a shape that would only fail validation in the first place.Test plan
test_orchestrator_recovers_from_invalid_child_tool_args— asserts the model sees field-level detail ("Invalid arguments for 'flights': message: Input should be a valid string") and that the rejected argument value never reaches the model's context or any log field.test_orchestrator_recovers_from_child_agent_crash— updated to assert the actual cause ("Model execution failed") reaches the model instead of a generic notice.make lint,make typecheck,make testall pass🤖 Generated with Claude Code