-
Notifications
You must be signed in to change notification settings - Fork 18.9k
fix(core): resolve infinite recursion in _dereference_refs_helper
with mixed $ref
objects
#32578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): resolve infinite recursion in _dereference_refs_helper
with mixed $ref
objects
#32578
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
CodSpeed WallTime Performance ReportMerging #32578 will not alter performanceComparing
|
CodSpeed Instrumentation Performance ReportMerging #32578 will not alter performanceComparing Summary
|
_dereference_refs_helper
with mixed $ref
objects
…h mixed $ref objects Fixes infinite recursion issue in JSON schema dereferencing when objects contain both $ref and other properties (e.g., nullable, description, additionalProperties). **Problem:** - Commit fb5da83 changed the condition from `set(obj.keys()) == {"$ref"}` to `"$ref" in set(obj.keys())` - This caused objects with $ref + other properties to be treated as pure $ref nodes - Result: other properties were lost and infinite recursion occurred with complex schemas **Solution:** - Restore pure $ref detection for objects with only $ref key - Add proper handling for mixed $ref objects that preserves all properties - Merge resolved reference content with other properties - Maintain cycle detection to prevent infinite recursion **Impact:** - Fixes Apollo MCP server schema integration (langchain-ai#32511) - Resolves tool binding infinite recursion with complex GraphQL schemas - Preserves backward compatibility with existing functionality - No performance impact - actually improves handling of complex schemas Fixes langchain-ai#32511
142771d
to
99d6684
Compare
Description: Fixes infinite recursion issue in JSON schema dereferencing when objects contain both $ref and other properties (e.g., nullable, description, additionalProperties). This was causing Apollo MCP server schemas to hang indefinitely during tool binding.
Problem:
set(obj.keys()) == {"$ref"}
to"$ref" in set(obj.keys())
Solution:
Impact:
Issue: Fixes #32511
Dependencies: None
Testing:
Verification:
make format
- All files properly formattedmake lint
- All linting checks passmake test
- All 1326 unit tests pass