.NET: Fix InMemoryCheckpointManager serialization - #1639
Merged
lokitoth merged 1 commit intoOct 23, 2025
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a serialization issue with InMemoryCheckpointManager that was preventing checkpoint state from being properly persisted and restored. The changes refactor internal fields to use public properties with [JsonInclude] attributes, add a new CheckpointInfoConverter for dictionary key serialization, and relocate shared escape/unescape utility methods to a base class.
Key changes:
- Made
InMemoryCheckpointManagerandRunCheckpointCacheserializable by converting private fields to internal properties with JSON attributes - Created
CheckpointInfoConverterto handleCheckpointInfoas dictionary keys during serialization - Moved escape/unescape helper methods from
ScopeKeyConverterto the base classJsonConverterDictionarySupportBase
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| JsonSerializationTests.cs | Added test to verify InMemoryCheckpointManager serialization round-trip and refactored existing checkpoint validation logic |
| InMemoryCheckpointManager.cs | Changed private _store field to public Store property with [JsonInclude] for JSON serialization |
| RunCheckpointCache.cs | Changed private _checkpointIndex and _cache fields to public properties with [JsonInclude] |
| CheckpointInfoConverter.cs | New converter enabling CheckpointInfo to be used as dictionary keys in JSON |
| JsonMarshaller.cs | Registered CheckpointInfoConverter in the internal serialization options |
| JsonConverterDictionarySupportBase.cs | Added shared Escape and Unescape methods with configurable escape character |
| ScopeKeyConverter.cs | Removed Escape and Unescape methods (moved to base class) and unused import |
| ExecutorIdentityConverter.cs | Added missing imports for updated converter implementation |
lokitoth
force-pushed
the
dev/dotnet_workflow/fix_workflow_thread_serialization
branch
from
October 22, 2025 21:00
74b2f28 to
67e8bbf
Compare
lokitoth
had a problem deploying
to
integration
October 22, 2025 21:00 — with
GitHub Actions
Failure
lokitoth
had a problem deploying
to
integration
October 22, 2025 21:00 — with
GitHub Actions
Failure
lokitoth
force-pushed
the
dev/dotnet_workflow/fix_workflow_thread_serialization
branch
from
October 22, 2025 21:08
67e8bbf to
a3a12c6
Compare
crickman
approved these changes
Oct 22, 2025
lokitoth
force-pushed
the
dev/dotnet_workflow/fix_workflow_thread_serialization
branch
from
October 22, 2025 21:43
a3a12c6 to
e1674c3
Compare
Checkpointing is used by the WorkflowHostAgent to be able to support resume from a provided thread. When a CheckpointManager is not specified, we use the InMemoryCheckpointManager and serialize its state into the thread's Serialize()ed JsonElement. At some point InMemoryCheckpointManager became not serializable, breaking this behaviour. This change restores serializability, and adds a test.
lokitoth
force-pushed
the
dev/dotnet_workflow/fix_workflow_thread_serialization
branch
from
October 23, 2025 15:42
c1d2879 to
95a6acb
Compare
TaoChenOSU
approved these changes
Oct 23, 2025
crickman
deleted the
dev/dotnet_workflow/fix_workflow_thread_serialization
branch
October 23, 2025 19:49
ReubenBond
pushed a commit
to ReubenBond/agent-framework
that referenced
this pull request
Oct 28, 2025
Checkpointing is used by the WorkflowHostAgent to be able to support resume from a provided thread. When a CheckpointManager is not specified, we use the InMemoryCheckpointManager and serialize its state into the thread's Serialize()ed JsonElement. At some point InMemoryCheckpointManager became not serializable, breaking this behaviour. This change restores serializability, and adds a test.
arisng
pushed a commit
to arisng/agent-framework
that referenced
this pull request
Feb 2, 2026
Checkpointing is used by the WorkflowHostAgent to be able to support resume from a provided thread. When a CheckpointManager is not specified, we use the InMemoryCheckpointManager and serialize its state into the thread's Serialize()ed JsonElement. At some point InMemoryCheckpointManager became not serializable, breaking this behaviour. This change restores serializability, and adds a test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Checkpointing is used by the WorkflowHostAgent to be able to support resume from a provided thread. When a CheckpointManager is not specified, we use the InMemoryCheckpointManager and serialize its state into the thread's Serialize()ed JsonElement.
At some point InMemoryCheckpointManager became not serializable, breaking this behaviour. This change restores serializability and adds a test.
Closes #1629
Contribution Checklist
Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.