Skip to content

Conversation

@keenborder786
Copy link

Takes care of the following issue raised in langchain: langchain-ai/langchain#33556

@keenborder786 keenborder786 changed the title fix: JsonPlusRedisSerializer handling proper searlization of Interrupt fix: JsonPlusRedisSerializer handling proper Serialization of Interrupt Oct 22, 2025
@keenborder786
Copy link
Author

@bsbodden please review

Copy link
Contributor

@bsbodden bsbodden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR addresses a real issue, but conflicts with PR #112. Needs modifications before merging.

Your PR includes this code (lines 43-52 in diff):

try:
    from langgraph.types import Interrupt

    if isinstance(obj, Interrupt):
        # Serialize Interrupt as a constructor format for proper deserialization
        return super().dumps(obj)
except ImportError:
    pass

This conflicts with PR #112 which removes the try/except pattern and changes dumps() to use orjson.dumps(obj, default=self._default) directly.

PR #112 establishes the correct pattern: always use orjson with the default handler

rebase this PR and:

  1. Remove the special Interrupt handling in dumps() (lines 43-52)

    • The _default handler should already serialize Interrupts correctly
    • Test to confirm this works
  2. Update tests if needed

Great work identifying and fixing this bug! 🎉

@keenborder786
Copy link
Author

@bsbodden please check now

@keenborder786
Copy link
Author

keenborder786 commented Oct 30, 2025

@bsbodden is their any other issue?

@keenborder786
Copy link
Author

@bsbodden

@rvdb7345
Copy link

Works for me!

@bsbodden
Copy link
Contributor

bsbodden commented Nov 15, 2025

@keenborder786 Tests and linting failures on this PR still. Pull down, rebase against main and try make format, make lint, and then make test-all, please

@keenborder786
Copy link
Author

@bsbodden okay let me check

@bsbodden
Copy link
Contributor

Hi @keenborder786! 👋

Thank you for your contribution on addressing the Interrupt serialization issue (#33556).
Current Status

The Interrupt serialization fix is already working in main! 🎉

PR #120 (which upgraded to LangGraph 1.0 and Checkpoint 3.0) included comprehensive Interrupt handling using a interrupt type marker approach. So the core functionality you were addressing is
already resolved.

What I've Prepared for You

I've updated your PR to work with the current codebase and created a patch file that you can apply. The updated version:

  1. Removes the implementation changes (now redundant since PR feat: Upgrade to LangGraph 1.0 and Checkpoint 3.0 (#110) #120 fixed this)
  2. Keeps your excellent test coverage - this is valuable!
  3. Updates tests for Checkpoint 3.0 API - migrated from dumps()/loads() to dumps_typed()/loads_typed()
  4. Adds 10 comprehensive tests covering:
    - Direct Interrupt serialization with type marker validation
    - Nested Interrupt objects in structures
    - Edge cases to prevent false positives
    - Both sync and async checkpoint integration
    - Complex value structures and empty/None scenarios

Test Results

✅ All 392 tests pass (382 existing + 10 new)
✅ No regressions
✅ 100% compatible with main branch

Files Attached

I've created:

  • pr-108-checkpoint-3.0-update.patch - Ready-to-apply patch file
  • PR-108-UPDATE-SUMMARY.md - Detailed explanation of changes

pr-108-checkpoint-3.0-update.patch
PR-108-UPDATE-SUMMARY.md

How to Apply

Save the patch file to your repo root

git checkout main
git checkout -b fix/interrupt-serialization-tests
git apply pr-108-checkpoint-3.0-update.patch
git push origin fix/interrupt-serialization-tests

Then you can update your existing PR or create a new one with these changes.

Value of This Update

Even though the implementation is already in main, your test coverage is still valuable because:

  • Regression prevention - Ensures Interrupt handling continues to work
  • Documentation - Shows developers how to properly use Interrupts with checkpoints
  • Edge case coverage - Tests scenarios not covered by existing tests

@keenborder786
Copy link
Author

@bsbodden excellent

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.

3 participants