Two issues remained after the cyclic-schema fix in #5478:
1. resolve_refs() silently degraded recursive $ref pointers to {},
causing sanitize_tool_params_for_anthropic_strict (and the OpenAI
variant) to produce children.items == {} for tree-shaped schemas.
Fix: return a type-preserving stub ({"type": "object"}) instead
of an empty dict when a circular reference is detected.
2. create_model_from_schema() called jsonref.replace_refs() which
throws JsonRefError on circular $ref graphs. Fix: catch the error
and fall back to _inline_top_level_ref(), which manually resolves
the top-level $ref while preserving $defs for inner resolution.
The existing in_progress cycle detection in _build_model_from_schema
then handles recursive references via ForwardRef.
Tests added for both paths, including mutual-recursion scenarios.
Co-Authored-By: João <joao@crewai.com>