Python: Add a global workflow checkpoint type registry - #7636
Python: Add a global workflow checkpoint type registry#7636Tao Chen (TaoChenOSU) wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
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: |
| 3. Later, restart the script and select that checkpoint. The workflow restores | ||
| and re-emits the pending request so the human can answer it. |
| register_checkpoint_type(_GloballyRegisteredTestState) | ||
|
|
||
| with tempfile.TemporaryDirectory() as tmpdir: | ||
| storage = FileCheckpointStorage(tmpdir) |
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
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.
Motivation & Context
Addresses #7574
Description & Review Guide
register_checkpoint_typeto add types to the registry.Related Issue
Fixes #7574
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.