Skip to content

fix(sdk): warn instead of silently skipping unresolved state schemas - #5166

Merged
Mason Daugherty (mdrxy) merged 1 commit into
mainfrom
mdrxy/deepagents/private-state-resolution-warning
Jul 29, 2026
Merged

fix(sdk): warn instead of silently skipping unresolved state schemas#5166
Mason Daugherty (mdrxy) merged 1 commit into
mainfrom
mdrxy/deepagents/private-state-resolution-warning

Conversation

@mdrxy

@mdrxy Mason Daugherty (mdrxy) commented Jul 29, 2026

Copy link
Copy Markdown
Member

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.

…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.
@github-actions github-actions Bot changed the title fix(deepagents): warn instead of silently skipping unresolved state schemas fix(sdk): warn instead of silently skipping unresolved state schemas Jul 29, 2026
@github-actions github-actions Bot added deepagents Related to the `deepagents` SDK / agent harness fix A bug fix (PATCH) internal User is a member of the `langchain-ai` GitHub organization size: XS < 50 LOC labels Jul 29, 2026

@open-swe open-swe Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Open SWE Review: No issues found

Open SWE reviewed this PR and found no potential bugs to report.

Open in WebView Open SWE trace

@mdrxy
Mason Daugherty (mdrxy) merged commit 2054c07 into main Jul 29, 2026
81 checks passed
@mdrxy
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepagents Related to the `deepagents` SDK / agent harness fix A bug fix (PATCH) internal User is a member of the `langchain-ai` GitHub organization size: XS < 50 LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant