Skip to content

fix: encode type and handle missing blob in Redis checkpoint writes #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

aymentil
Copy link
Contributor

Summary

Fixes three bugs in AsyncRedisSaver._aload_pending_sends that prevent Human-in-the-Loop workflows from resuming correctly with Redis checkpointers.

Problem

HIL workflows work fine with InMemory saver but crash with Redis checkpointers due to:

  1. Wrong field name in RediSearch query (blob instead of $.blob)
  2. Incorrect namespace handling preventing matches for empty/sentinel namespaces
  3. Wrong data type returned (string instead of bytes) causing decode errors

Solution

  • Use JSON-path $.blob in return_fields instead of plain blob
  • Use raw checkpoint_ns instead of to_storage_safe_str(checkpoint_ns) in filter
  • Encode type field to bytes: d.type.encode() instead of d.type

Changes

  • Modified langgraph/checkpoint/redis/aio.py in AsyncRedisSaver._aload_pending_sends method

Testing

  • Verified HIL workflows now resume correctly with Redis checkpointers
  • Existing functionality remains intact
  • No breaking changes to public API

Fixes #5074 link

@bsbodden
Copy link
Contributor

bsbodden commented Jun 13, 2025

@aymentil, can you run all the tests locally with make test-all and then rebase and rerun them? Thanks!

amend: I rebased it locally and added the same fixes to the sync implementations, I will push to the PR branch and then merge it. Great job!

bsbodden added a commit that referenced this pull request Jun 13, 2025
  This commit completes PR #57 by applying the same fixes to all four
  implementations of the pending_sends loading methods:

  - RedisSaver._load_pending_sends (sync)
  - ShallowRedisSaver._load_pending_sends (shallow sync)
  - AsyncShallowRedisSaver._aload_pending_sends (shallow async)

  The fixes include:
  1. Using $.blob instead of blob for JSON path access
  2. Using raw checkpoint_ns without to_storage_safe_str conversion
  3. Encoding type to bytes with proper error handling for missing blobs

  Also adds comprehensive test coverage for Human-in-the-Loop functionality across all implementations.
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.

LGTM! Thanks for the contribution! 🚀🔥🤘🏾

@bsbodden bsbodden merged commit f2e3c32 into redis-developer:main Jun 13, 2025
20 checks passed
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.

2 participants