Repository navigation
fix(langgraph): resolve postponed annotations in entrypoint signature - #9519
Closed
manasa1508 wants to merge 1 commit into
Closed
manasa1508 wants to merge 1 commit into
manasa1508 wants to merge 1 commit into
Conversation
`entrypoint` read the function signature without evaluating string annotations, so under `from __future__ import annotations` the input, output and save types were strings. That broke the input/output JSON schemas, `entrypoint.final[R, S]` unwrapping, and the strict msgpack allowlist. Evaluate annotations with `eval_str=True`, falling back to the unevaluated signature when they can't be resolved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
This PR has been automatically closed because you are not assigned to the linked issue. External contributors must be assigned to an issue before opening a PR for it. Please:
Maintainers: reopen this PR or remove the |
7 tasks done
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.
Fixes #9518
@entrypointnow resolves string annotations (from __future__ import annotations) when reading the function signature, so input/output schemas,entrypoint.final[R, S]unwrapping, and the strict msgpack allowlist work the same as without the future import. If the annotations can't be evaluated (e.g.TYPE_CHECKING-only imports), it falls back to the previous unevaluated signature, so existing code is unaffected.except Exceptionis intentional: evaluating annotations can raise arbitrary errors, and before this change the decorator never evaluated them, so a narrower catch could make decorating start to fail. No JS change needed, since TS types aren't available at runtime.How I verified
tests/test_func_postponed_annotations.py(needs its own module so the types are module-level under the future import): 4 of the 5 tests fail on main and pass with the fix; the fifth guards the fallback.make format,make lint, and the fulllibs/langgraphsuite pass, withtest_pregel.py/test_pregel_async.pyalso run underLANGGRAPH_STRICT_MSGPACK=true.