Skip to content

fix(langgraph): resolve postponed annotations in entrypoint signature - #9519

Closed
manasa1508 wants to merge 1 commit into
langchain-ai:mainfrom
manasa1508:fix/entrypoint-postponed-annotations
Closed

manasa1508 wants to merge 1 commit into
langchain-ai:mainfrom
manasa1508:fix/entrypoint-postponed-annotations

Conversation

@manasa1508

@manasa1508 manasa1508 commented Oct 31, 2026 •

Copy link
Copy Markdown

Fixes #9518

@entrypoint now 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 Exception is 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

  • New 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 full libs/langgraph suite pass, with test_pregel.py/test_pregel_async.py also run under LANGGRAPH_STRICT_MSGPACK=true.

`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>
@github-actions

Copy link
Copy Markdown
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:

  1. Comment on the linked issue to request assignment from a maintainer
  2. Once assigned, your PR will be reopened automatically

Maintainers: reopen this PR or remove the missing-issue-link label to bypass this check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@entrypoint ignores postponed annotations (from __future__ import annotations): schemas fail and entrypoint.final is not unwrapped

1 participant