Skip to content

Python: Add a global workflow checkpoint type registry - #7636

Open
Tao Chen (TaoChenOSU) wants to merge 3 commits into
mainfrom
issue-7574
Open

Python: Add a global workflow checkpoint type registry#7636
Tao Chen (TaoChenOSU) wants to merge 3 commits into
mainfrom
issue-7574

Conversation

@TaoChenOSU

@TaoChenOSU Tao Chen (TaoChenOSU) commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Motivation & Context

Addresses #7574

Description & Review Guide

  • What are the major changes?
    • Add a global checkpoint type registry and a help method register_checkpoint_type to add types to the registry.
  • What is the impact of these changes?
    • Allow code that may not have direct access to the checkpoint storage to register types, such as Foundry Hosted Agent.
  • What do you want reviewers to focus on?
    • The implementation of the registry and the helper method.

Related Issue

Fixes #7574

Contribution Checklist

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR is linked to an issue and there is no other open PR for this issue (see Related Issue above).
  • This is not a breaking change. If it is a breaking change, add the breaking change label (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.

@TaoChenOSU Tao Chen (TaoChenOSU) self-assigned this Aug 12, 2026
@TaoChenOSU Tao Chen (TaoChenOSU) added the python Usage: [Issues, PRs], Target: Python label Aug 12, 2026
Copilot AI balanced review requested due to automatic review settings August 12, 2026 23:48
@TaoChenOSU Tao Chen (TaoChenOSU) added the workflows Usage: [Issues, PRs], Target: Workflows label Aug 12, 2026
@github-actions github-actions Bot changed the title Add a global workflow checkpoint type registry Python: Add a global workflow checkpoint type registry Aug 12, 2026
@TaoChenOSU
Tao Chen (TaoChenOSU) marked this pull request as ready for review August 12, 2026 23:50

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 a process-wide workflow checkpoint type registry for custom deserialization types.

Changes:

  • Adds and exports register_checkpoint_type.
  • Integrates registered types with file checkpoint loading.
  • Adds coverage and updates the human-in-the-loop sample.

Reviewed changes

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

Show a summary per file
File Description
checkpoint_with_human_in_the_loop.py Demonstrates type registration and checkpoint restoration.
test_checkpoint_unrestricted_pickle.py Tests globally registered checkpoint types.
_checkpoint.py Implements the registry and file-storage integration.
__init__.pyi Exposes the typed public API.
__init__.py Exposes the runtime public API.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

_REGISTERED_CHECKPOINT_TYPE_KEYS: set[str] = set()


def register_checkpoint_type(cls: type[Any]) -> None:
Comment on lines +60 to +61
3. Later, restart the script and select that checkpoint. The workflow restores
and re-emits the pending request so the human can answer it.
Comment on lines +315 to +318
register_checkpoint_type(_GloballyRegisteredTestState)

with tempfile.TemporaryDirectory() as tmpdir:
storage = FileCheckpointStorage(tmpdir)
@github-actions

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework/_workflows
   _checkpoint.py166298%45, 334
TOTAL45808423690% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
9306 36 💤 0 ❌ 0 🔥 2m 6s ⏱️

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

MAF Automated Review — Iteration 1

Result: No findings
Scope: full PR (3 commit(s)): 4e8c20eab5bc, 99fbc651601c, c4ffd78a7812
Model: gpt-5.6-sol

Overview

The PR adds process-wide registration for application checkpoint classes and dynamically merges registered keys into every FileCheckpointStorage load. It validates registrations as classes, keeps per-storage allowlists intact, and continues to use the restricted unpickler's blocked-global and nested-type guards. After deduplication against unresolved feedback and reconciliation against the documented trusted-storage model, no new publishable concern remains.

Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.

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

None yet

Development

Successfully merging this pull request may close these issues.

Python: [Feature]: Allow a global registry of checkpoint allow types

2 participants