Problem
When extracting changes from a messy PR, I blindly copied a fix to retry.py without questioning whether it was needed.
The signature preservation fix was for pydantic-ai tool schema generation. retry_on_json_error is a JSON parsing utility - it never gets passed to pydantic-ai's Tool(). The fix there was a shim.
Root Cause
Cargo culting. "The original PR had it, so I included it."
Lesson
Before applying any fix, ask: "Does this code path actually hit the problem?"
For the signature preservation bug specifically:
- pydantic-ai uses
inspect.signature()to generate JSON schemas for tools - Only wrappers that produce functions passed to
Tool()need the fix retry_on_json_errorwraps JSON parsers, not pydantic-ai tools
Rule
If you encounter a shim, fix it. Don't care who made it. Don't propagate it.
Files That Actually Needed The Fix
research_agent.py-ProgressTracker.wrap_tool()wraps tools for pydantic-aidecorators.py-base_tool()andfile_tool()wrap tools for pydantic-aipresent_plan.py-create_present_plan_tool()creates a pydantic-ai tool
Files That Did NOT Need The Fix
retry.py- wraps JSON parsers, not pydantic-ai tools