Skip to content

docs: add file-tool error flow standardization design #455#456

Open
andrii-novikov wants to merge 1 commit into
developmentfrom
docs/455-file-tool-error-flow-design
Open

docs: add file-tool error flow standardization design #455#456
andrii-novikov wants to merge 1 commit into
developmentfrom
docs/455-file-tool-error-flow-design

Conversation

@andrii-novikov

Copy link
Copy Markdown
Collaborator

Applicable issues

Description of changes

Adds the design doc docs/designs/file_tool_error_flow.md (Status: Draft) for standardizing the internal file tools' error flow onto ToolErrorException.

Why: #408 introduced forward_tool_error_message, which forwards a tool's real error text to the LLM — but the gate in compose_tool_error_fallback_message forwards only ToolErrorException subclasses, and those exist for MCP and REST tools only. The internal file tools (dial_files_tooling/) let raw DialExceptions escape, so the flag is a silent no-op for them: the model receives only generic fallback instructions and reports vague failures like "the backend tool is failing" — the symptom of #447. On top of that, _download_text mislabels Core 5xx errors as InvalidToolCallParameterException, steering the model into "fix the parameter and retry" for a server fault and bypassing configured fallback strategies.

The design: every failure escaping a file tool becomes one of exactly two standardized shapes — InvalidToolCallParameterException for parameter-shaped failures (404/403/etag conflict/bad range — unchanged retry behavior) and a new FileToolErrorException(ToolErrorException) for genuine tool/server failures, produced by a translation helper in _base_file_tool.py that replaces the 403-only _check_permission_denied. All nine file-tool configs ship forward_tool_error_message=True defaults. Zero changes to the fallback machinery; no schema changes (the file-tool configs are hardcoded, not manifest-driven).

No implementation code in this PR — the doc will go through design review separately; implementation follows in its own PR.

Checklist

  • Title of the pull request follows Conventional Commits specification
  • Design documented is updated/created and approved by the team (if applicable)
  • Documentation is updated/created (if applicable)
  • [ ] Changes are tested on review environment (docs-only change, nothing to deploy)
  • [ ] App schema changes are backward compatible, or breaking changes are documented with a migration guide (no schema changes)
  • [ ] Integration tests pass (docs-only change)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Internal file tools let raw DialExceptions escape their bodies, so the
forward_tool_error_message flag introduced by #408 is a silent no-op for
them: compose_tool_error_fallback_message forwards only ToolErrorException
subclasses, which exist for MCP and REST tools but not for file tools. The
LLM then reports vague failures like "the backend tool is failing" (#447).
_download_text additionally mislabels Core 5xx errors as
InvalidToolCallParameterException, telling the model to fix a parameter
that is not broken and bypassing configured fallback strategies.

The design standardizes every failure escaping a file tool into one of two
shapes: InvalidToolCallParameterException for parameter-shaped failures
(unchanged retry-with-a-fixed-value behavior) and a new
FileToolErrorException(ToolErrorException) for genuine tool/server
failures, plus forward_tool_error_message=True defaults for all nine file
tool configs. Zero changes to the fallback machinery.

Implementation is a follow-up; this PR carries only the design doc.
@andrii-novikov
andrii-novikov requested a review from ypldan as a code owner July 17, 2026 10:30
@andrii-novikov andrii-novikov self-assigned this Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants