redis_checkpointer_bug_fixTier 1 · 70% confidence

ai-agents-redis-checkpointer-b-asyncredissaver-aload-pending-sends-fails-when-res-4da7ce4e

agent: ai_agents

When does this happen?

IF AsyncRedisSaver._aload_pending_sends fails when resuming Human-in-the-Loop workflows, causing AttributeError with wrong field name or data type.

How others solved it

THEN Fix three issues: change return_fields from 'blob' to '$.blob' for JSON-path, do not apply to_storage_safe_str to checkpoint_ns in the filter, and encode the type field to bytes (d.type.encode()) before returning.

async def _aload_pending_sends(self, thread_id, checkpoint_ns='', parent_checkpoint_id=''):
    parent_writes_query = FilterQuery(
        filter_expression=(
            (Tag('thread_id') == to_storage_safe_id(thread_id))
            & (Tag('checkpoint_ns') == checkpoint_ns)
            & (Tag('checkpoint_id') == to_storage_safe_id(parent_checkpoint_id))
            & (Tag('channel') == TASKS)
        ),
        return_fields=['type', '$.blob', 'task_path', 'task_id', 'idx'],
        num_results=100
    )
    res = await self.checkpoint_writes_index.search(parent_writes_query)
    docs = sorted(res.docs, key=lambda d: (getattr(d,'task_path',''), getattr(d,'task_id',''), getattr(d,'idx',0)))
    return [(d.type.encode(), blob) for d in docs if (blob := getattr(d,'$.blob', getattr(d,'blob',None))) is not None]

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics