Skip to content

Fix Pydantic constraints in workflow sandboxes - #1914

Open
tconley1428 wants to merge 2 commits into
mainfrom
fix/1897-annotated-types-passthrough
Open

tconley1428 wants to merge 2 commits into
mainfrom
fix/1897-annotated-types-passthrough

Conversation

@tconley1428

Copy link
Copy Markdown
Contributor

Pydantic can silently ignore constraints when workflow sandboxes reload annotated_types, because its process-wide constraint cache uses class identity. Pass through annotated_types by default so constraints remain enforced inside and outside the sandbox.

Add regression tests in fresh processes for both host-first and sandbox-first model creation, covering Annotated metadata, Field, and conint, and add a changelog entry.

Fixes #1897.

Validation:

  • Confirmed both regression cases fail before the fix and pass after it.
  • Workflow sandbox suite: 29 passed, 1 skipped.
  • Ruff import and formatting checks, Pyright for changed Python files, and git diff --check passed.
  • Full poe lint was blocked by a pre-existing syntax error in an unrelated local OpenTelemetry edit, which is excluded from this PR.

@tconley1428
tconley1428 requested a review from a team as a code owner October 1, 2026 23:07

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflow sandbox re-imports annotated_types, so pydantic silently drops constraints

2 participants