Skip to content

Python: Add OpenAI types to default checkpoint encoding allow list - #5297

Merged
Evan Mattson (moonbox3) merged 2 commits into
mainfrom
taochen/python-add-openai-types-to-allow-list
Apr 16, 2026
Merged

Python: Add OpenAI types to default checkpoint encoding allow list#5297
Evan Mattson (moonbox3) merged 2 commits into
mainfrom
taochen/python-add-openai-types-to-allow-list

Conversation

@TaoChenOSU

@TaoChenOSU Tao Chen (TaoChenOSU) commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

When a workflow using OpenAI services get checkpointed, the file-based checkpoint storage raises the following warning:

Failed to decode pickled checkpoint data: Checkpoint deserialization blocked for type 'openai.types.responses.response_output_text:ResponseOutputText'. To allow this type, either include its 'module:qualname' key in the 'allowed_types' set passed to 'decode_checkpoint_value', or add it to 'allowed_checkpoint_types' on your checkpoint storage (for example, 'FileCheckpointStorage.allowed_checkpoint_types').

Description

Common types should be automatically included. This PR adds OpenAI types.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@TaoChenOSU Tao Chen (TaoChenOSU) self-assigned this Apr 16, 2026
@TaoChenOSU Tao Chen (TaoChenOSU) added the python Usage: [Issues, PRs], Target: Python label Apr 16, 2026
@TaoChenOSU Tao Chen (TaoChenOSU) added the workflows Usage: [Issues, PRs], Target: Workflows label Apr 16, 2026
Copilot AI review requested due to automatic review settings April 16, 2026 03:27
@github-actions github-actions Bot changed the title Add OpenAI types to default checkpoint encoding allow list Python: Add OpenAI types to default checkpoint encoding allow list Apr 16, 2026
@moonbox3

Evan Mattson (moonbox3) commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework/_workflows
   _checkpoint.py158199%299
   _checkpoint_encoding.py640100% 
TOTAL27671320088% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
5597 20 💤 0 ❌ 0 🔥 1m 28s ⏱️

Copilot AI 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.

Pull request overview

Adds OpenAI SDK model types to the “always allowed” set for restricted checkpoint deserialization, so workflows using OpenAI objects can be checkpointed/restored without requiring users to manually extend allowed_checkpoint_types.

Changes:

  • Expands restricted unpickling allow-list to include OpenAI SDK modules by prefix match.
  • Updates FileCheckpointStorage docs to mention OpenAI SDK types are allowed by default.
  • Adds tests asserting OpenAI Chat Completions and Responses usage types can round-trip through restricted checkpoint encoding.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
python/packages/core/agent_framework/_workflows/_checkpoint_encoding.py Adds OpenAI module-prefix allowance to restricted unpickling logic.
python/packages/core/agent_framework/_workflows/_checkpoint.py Updates FileCheckpointStorage docstring to describe OpenAI types as implicitly allowed.
python/packages/core/tests/workflow/test_checkpoint_unrestricted_pickle.py Adds regression tests validating restricted decode accepts OpenAI SDK type instances.

Comment thread python/packages/core/agent_framework/_workflows/_checkpoint.py Outdated
@moonbox3
Evan Mattson (moonbox3) merged commit 8f7fd95 into main Apr 16, 2026
31 checks passed
@TaoChenOSU
Tao Chen (TaoChenOSU) deleted the taochen/python-add-openai-types-to-allow-list branch April 16, 2026 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python workflows Usage: [Issues, PRs], Target: Workflows

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants