fix(sdk): warn instead of silently skipping unresolved state schemas - #5166
Merged
Mason Daugherty (mdrxy) merged 1 commit intoJul 29, 2026
Merged
Conversation
…chemas `private_state_field_names` resolved annotations under a blanket `contextlib.suppress(Exception)`. A schema whose `PrivateStateAttr` annotation references a `TYPE_CHECKING`-only name raises `NameError` from `get_type_hints`, so the function returned an empty set with no diagnostic -- and every private field on that schema is then forwarded to, and merged back from, subagents. Catch only the annotation-resolution errors, log which schema failed and what it means, and keep skipping that schema rather than failing the whole agent.
Mason Daugherty (mdrxy)
deleted the
mdrxy/deepagents/private-state-resolution-warning
branch
July 29, 2026 20:11
Marcelo5444
pushed a commit
to Marcelo5444/deepagents
that referenced
this pull request
Jul 30, 2026
…angchain-ai#5166) `private_state_field_names` resolved annotations under a blanket `contextlib.suppress(Exception)`. A schema whose `PrivateStateAttr` annotation references a `TYPE_CHECKING`-only name raises `NameError` from `get_type_hints`, so the function returned an empty set with no diagnostic. Every private field on that schema is then forwarded to, and merged back from, subagents — the exact leak the marker exists to prevent, with nothing in the logs to explain it. This catches only the annotation-resolution errors (`NameError`, `TypeError`, `AttributeError`), logs which schema failed and what the consequence is, and still skips that schema rather than failing the whole agent — a caller may own several unrelated schemas. Split out of langchain-ai#5164.
Mason Daugherty (mdrxy)
added a commit
that referenced
this pull request
Jul 30, 2026
…5166) `private_state_field_names` resolved annotations under a blanket `contextlib.suppress(Exception)`. A schema whose `PrivateStateAttr` annotation references a `TYPE_CHECKING`-only name raises `NameError` from `get_type_hints`, so the function returned an empty set with no diagnostic. Every private field on that schema is then forwarded to, and merged back from, subagents — the exact leak the marker exists to prevent, with nothing in the logs to explain it. This catches only the annotation-resolution errors (`NameError`, `TypeError`, `AttributeError`), logs which schema failed and what the consequence is, and still skips that schema rather than failing the whole agent — a caller may own several unrelated schemas. Split out of #5164.
Mason Daugherty (mdrxy)
added a commit
that referenced
this pull request
Jul 30, 2026
> [!CAUTION] > Merging this PR will automatically publish to **PyPI** and create a **GitHub release**. For the full release process, see [`.github/RELEASING.md`](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md). --- _Release notes preview: keep this section in sync with the package `CHANGELOG.md`. Publish reads the merged CHANGELOG via `release.yml`, not this PR description — keep them aligned anyway so the PR stays an accurate historical record for reviewers and anyone returning later._ --- ## [0.7.1](deepagents==0.7.0...deepagents==0.7.1) (2026-07-30) ### Features - Mark editable installs in `lc_versions.deepagents` ([#5158](#5158)) ### Bug Fixes - Return an empty read for degenerate `read_file` windows ([#5184](#5184)) - Warn instead of silently skipping unresolved state schemas ([#5166](#5166)) _End release notes preview._ --- > [!NOTE] > A **New Contributors** section is appended to the GitHub release notes automatically at publish time (see [Release Pipeline](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md#release-pipeline), step 2). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Mason Daugherty <github@mdrxy.com> Co-authored-by: langchain-oss-automated-triage[bot] <248757908+langchain-oss-automated-triage[bot]@users.noreply.github.com>
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.
private_state_field_namesresolved annotations under a blanketcontextlib.suppress(Exception).A schema whose
PrivateStateAttrannotation references aTYPE_CHECKING-only name raisesNameErrorfromget_type_hints, so the function returned an empty set with no diagnostic. Every private field on that schema is then forwarded to, and merged back from, subagents — the exact leak the marker exists to prevent, with nothing in the logs to explain it.This catches only the annotation-resolution errors (
NameError,TypeError,AttributeError), logs which schema failed and what the consequence is, and still skips that schema rather than failing the whole agent — a caller may own several unrelated schemas.Split out of #5164.