SELECT_PENDING_SENDS_SQL = f"\nselect\n checkpoint_id,\n array_agg(
array[type::bytea, blob] order by task_path,
task_id,
idx) as sends\nfrom checkpoint_writes\nwhere thread_id = %s\n and checkpoint_id = any(%s
)\n and channel = '{TASKS}'\ngroup by checkpoint_id\n"