[PR #5663] fix(checkpointer-postges): Fix to load older checkpoint values as CheckpointTuple #4574

Closed
opened 2026-02-20 17:50:24 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/5663

State: closed
Merged: No


Fix to handle checkpoint tuple for older checkpointer earlier to version 2.0.22

The older checkpoint history doesn't contains channel_values under checkpoint.

Current logic: value["checkpoint"].get("channel_values")
New changes: value["checkpoint"].get("channel_values",{})

This change handles if the element doesn't exist, it will default to {} mapping.

Older checkpoint values (structure only):

{
    "thread_id": "05e0c533-5074-4803-bd7c-b1afb82a1be4",
    "checkpoint": {
        "v": 1,
        "id": "1eff9dcd-8713-6d6f-8030-2231a95b30c9",
        "ts": "2025-03-05T16:13:59.119488+00:00",
        "pending_sends": [],
        "versions_seen": {
            "general": {
                "general_tools": "00000000000000000000000000000019.0.03995078972188815",
                "branch:synthesize:__self__:general": "00000000000000000000000000000049.0.061818720158663076"
            },
            "__input__": {},
            "__start__": {
                "__start__": "00000000000000000000000000000045.0.6746333308556777"
            },
            "synthesize": {
                "branch:main_router_invoke:router:synthesize": "00000000000000000000000000000048.0.19185744542437477"
            },
            "general_tools": {
                "branch:general:should_continue_tools:general_tools": "00000000000000000000000000000018.0.3155475978112713"
            },
            "main_router_invoke": {
                "branch:main_message_filter:multimodalrouter:main_router_invoke": "00000000000000000000000000000047.0.8906768827301736"
            },
            "main_message_filter": {
                "start:main_message_filter": "00000000000000000000000000000046.0.7508523256119448"
            }
        },
        "channel_versions": {
            "key": "00000000000000000000000000000048.0.33974018026966",
            "general": "00000000000000000000000000000050.0.3541241616249834",
            "messages": "00000000000000000000000000000050.0.43941528250181383",
            "question": "00000000000000000000000000000048.0.4024424437216071",
            "__start__": "00000000000000000000000000000046.0.47905480289473445",
            "synthesize": "00000000000000000000000000000050.0.7331940315667593",
            "general_tools": "00000000000000000000000000000020.0.5990349548781237",
            "internal_messages": "00000000000000000000000000000048.0.012851823317911903",
            "main_router_invoke": "00000000000000000000000000000049.0.35525962593415095",
            "main_message_filter": "00000000000000000000000000000048.0.8179992934717717",
            "start:main_message_filter": "00000000000000000000000000000047.0.033154834137578804",
            "branch:synthesize:__self__:general": "00000000000000000000000000000050.0.3194527177834606",
            "branch:main_router_invoke:router:synthesize": "00000000000000000000000000000049.0.08633173962701424",
            "branch:general:should_continue_tools:general_tools": "00000000000000000000000000000019.0.1101370626783541",
            "branch:main_message_filter:multimodalrouter:main_router_invoke": "00000000000000000000000000000048.0.7751216560137044"
        }
    },
    "checkpoint_ns": "",
    "checkpoint_id": "1eff9dcd-8713-6d6f-8030-2231a95b30c9",
    "parent_checkpoint_id": "1eff9dcc-baf3-6fc8-802f-1c5bf61f69f6",
    "metadata": {
        "step": 48,
        "think": "true",
        "source": "loop",
        "writes": {
            "general": {
                "messages": {
                    "id": [
                        "langchain",
                        "schema",
                        "messages",
                        "AIMessage"
                    ],
                    "lc": 1,
                    "type": "constructor",
                    "kwargs": {
                        "id": "run-5d14de39-f522-4f75-879c-65eebb81a47",
                        "name": "general",
                        "type": "ai",
                        "content": [
                            {  "type": "reasoning_content",
                                "index": 0,
                                "reasoning_content": {
                                    "text": "The user is having an issue where the first element in their HTML/markdown content isnt rendering properly, while all other elements are rendering correctly. This is a common issue in various rendering contexts, especially when dealing with markdown parsers or certain HTML rendering engines. Let me think about the potential causes and solutions.\n\nCommon causes for the first element not rendering:\n1. Missing whitespace or newlines before the first element\n2. Context/parsing state issues in the markdown renderer\n3. Special characters or invisible formatting at the beginning of the document\n4. CSS issues affecting only the first element\n5. Nested container issues where the first element is being incorrectly handled\n\nLet me provide solutions for each of these potential causes.", "type": "texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttextsignature", "signature": "EqoBCkgIARABGAIiQNKAF6SCJrcjp6wQGsKDp3pX9wpI2ywxOE2ZfERB1CSKnPB0+81UtvXBNQ0qJM2C+LJAZoKc0Y+J9YXcASGxJ6kSDLIBXhWzo/bBijhIMBoMkjOrs2CI2PP+fztHIjBGMet4Noyi+wtxwUMC4+PZ3FzIEGgCS1Gm3D9/D0kpwyB9tCmPGIr7CQrbHSeWYZMqEHnNPB73nyPHr04ddJHfAOA="}}, {"text": "# First Element Not Rendering in HTML/Markdown 🔍\n\nThis is a common issue in markdown and HTML rendering. Here are several solutions depending on your specific implementation:\n\n## 🛠️ Solutions for Markdown Rendering\n\n### 1. Add an Empty Line at the Beginning\n\n```markdown\n<!-- Add an empty line here -->\n\n# Now your heading will render\nContent goes here...\n```\n\n### 2. Add a Non-Breaking Space at the Beginning\n\n```markdown\n&nbsp;\n\n# Your heading should now render\nContent goes here...\n```\n\n### 3. Insert an HTML Comment Before Content\n\n```markdown\n<!-- This comment helps establish context for the parser -->\n# Your heading should now render\nContent goes here...\n```\n\n## 🛠️ Solutions for HTML/Components\n\n### 1. Check Container Elements\n\nEnsure your container element is properly initialized:",
                                            "type": "text",
                                            "index": 1
                                        }
                                    ],
                                    "tool_calls": [],
                                    "usage_metadata": {
                                        "input_tokens": 4040,
                                        "total_tokens": 4717,
                                        "output_tokens": 677
                                    },
                                    "response_metadata": {
                                        "llm": "us.anthropic.claude-3-7-sonnet-20250219-v1:0",
                                        "metrics": {
                                            "latencyMs": 21154
                                        },
                                        "stopReason": "end_turn"
                                    },
                                    "invalid_tool_calls": []
                                }
                            }
                        }
                    },
                    "parents": {},
                    "thread_id": "05e0c533-5074-4803-bd7c-b1afb82a1be4"
                },
                "channel_values": [
                    [
                        "key",
                        "msgpack", "91a7general"
                    ],
                    [
                        "general",
                        "msgpack", "a7general"
                    ],
                    [
                        "messages",
                        "msgpack", "dc0012c7d30594bdlangchain_core.messages.humanacHumanMessage87a7content9182a4typea4texta4textafteach me pythonb1additional_kwargs80b1response_metadata80a4typea5humana4namec0a2idd9$8b6d6bd9-c5ef-4db6-b9df-6071b7902dfaa7examplec2b3model_validate_jsonc8\r020594balangchain_core.messages.aia9AIMessage8aa7content9183a4typea4texta4textda0bv# f09f908d Python Programming Tutorial\n\nPython is one of the most popular and versatile programming languages in the world. It\"s great for beginners due to its simple, readable syntax while still being powerful enough for professional applications.\n\n## Getting Started with Python\n\n### Installation\n- Download Python from [python.org](https://www.python.org/downloads/)\n- son"
                    ],
                    [
                        "question",
                        "msgpack", "86a7generald9Uabout the html markdown, first element is not rendering, rest all rendering correctlyaasynthesizec0a3cprc0a6devopsc0acdirect_salesc0a3pmoc0"
                    ],
                    [
                        "__start__",
                        "empty",
                        null
                    ],
                    
                    [
                        "internal_messages",
                        "msgpack", "90"
                    ],
           
                    [
                        "branch:main_message_filter:multimodalrouter:main_router_invoke",
                        "empty",
                        null
                    ]
                ],
                "pending_writes": null
            }
        
        
**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/5663 **State:** closed **Merged:** No --- Fix to handle checkpoint tuple for older checkpointer earlier to version 2.0.22 The older checkpoint history doesn't contains `channel_values` under checkpoint. Current logic: `value["checkpoint"].get("channel_values")` New changes: `value["checkpoint"].get("channel_values",{})` This change handles if the element doesn't exist, it will default to `{}` mapping. Older checkpoint values (structure only): ``` { "thread_id": "05e0c533-5074-4803-bd7c-b1afb82a1be4", "checkpoint": { "v": 1, "id": "1eff9dcd-8713-6d6f-8030-2231a95b30c9", "ts": "2025-03-05T16:13:59.119488+00:00", "pending_sends": [], "versions_seen": { "general": { "general_tools": "00000000000000000000000000000019.0.03995078972188815", "branch:synthesize:__self__:general": "00000000000000000000000000000049.0.061818720158663076" }, "__input__": {}, "__start__": { "__start__": "00000000000000000000000000000045.0.6746333308556777" }, "synthesize": { "branch:main_router_invoke:router:synthesize": "00000000000000000000000000000048.0.19185744542437477" }, "general_tools": { "branch:general:should_continue_tools:general_tools": "00000000000000000000000000000018.0.3155475978112713" }, "main_router_invoke": { "branch:main_message_filter:multimodalrouter:main_router_invoke": "00000000000000000000000000000047.0.8906768827301736" }, "main_message_filter": { "start:main_message_filter": "00000000000000000000000000000046.0.7508523256119448" } }, "channel_versions": { "key": "00000000000000000000000000000048.0.33974018026966", "general": "00000000000000000000000000000050.0.3541241616249834", "messages": "00000000000000000000000000000050.0.43941528250181383", "question": "00000000000000000000000000000048.0.4024424437216071", "__start__": "00000000000000000000000000000046.0.47905480289473445", "synthesize": "00000000000000000000000000000050.0.7331940315667593", "general_tools": "00000000000000000000000000000020.0.5990349548781237", "internal_messages": "00000000000000000000000000000048.0.012851823317911903", "main_router_invoke": "00000000000000000000000000000049.0.35525962593415095", "main_message_filter": "00000000000000000000000000000048.0.8179992934717717", "start:main_message_filter": "00000000000000000000000000000047.0.033154834137578804", "branch:synthesize:__self__:general": "00000000000000000000000000000050.0.3194527177834606", "branch:main_router_invoke:router:synthesize": "00000000000000000000000000000049.0.08633173962701424", "branch:general:should_continue_tools:general_tools": "00000000000000000000000000000019.0.1101370626783541", "branch:main_message_filter:multimodalrouter:main_router_invoke": "00000000000000000000000000000048.0.7751216560137044" } }, "checkpoint_ns": "", "checkpoint_id": "1eff9dcd-8713-6d6f-8030-2231a95b30c9", "parent_checkpoint_id": "1eff9dcc-baf3-6fc8-802f-1c5bf61f69f6", "metadata": { "step": 48, "think": "true", "source": "loop", "writes": { "general": { "messages": { "id": [ "langchain", "schema", "messages", "AIMessage" ], "lc": 1, "type": "constructor", "kwargs": { "id": "run-5d14de39-f522-4f75-879c-65eebb81a47", "name": "general", "type": "ai", "content": [ { "type": "reasoning_content", "index": 0, "reasoning_content": { "text": "The user is having an issue where the first element in their HTML/markdown content isnt rendering properly, while all other elements are rendering correctly. This is a common issue in various rendering contexts, especially when dealing with markdown parsers or certain HTML rendering engines. Let me think about the potential causes and solutions.\n\nCommon causes for the first element not rendering:\n1. Missing whitespace or newlines before the first element\n2. Context/parsing state issues in the markdown renderer\n3. Special characters or invisible formatting at the beginning of the document\n4. CSS issues affecting only the first element\n5. Nested container issues where the first element is being incorrectly handled\n\nLet me provide solutions for each of these potential causes.", "type": "texttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttexttextsignature", "signature": "EqoBCkgIARABGAIiQNKAF6SCJrcjp6wQGsKDp3pX9wpI2ywxOE2ZfERB1CSKnPB0+81UtvXBNQ0qJM2C+LJAZoKc0Y+J9YXcASGxJ6kSDLIBXhWzo/bBijhIMBoMkjOrs2CI2PP+fztHIjBGMet4Noyi+wtxwUMC4+PZ3FzIEGgCS1Gm3D9/D0kpwyB9tCmPGIr7CQrbHSeWYZMqEHnNPB73nyPHr04ddJHfAOA="}}, {"text": "# First Element Not Rendering in HTML/Markdown 🔍\n\nThis is a common issue in markdown and HTML rendering. Here are several solutions depending on your specific implementation:\n\n## 🛠️ Solutions for Markdown Rendering\n\n### 1. Add an Empty Line at the Beginning\n\n```markdown\n<!-- Add an empty line here -->\n\n# Now your heading will render\nContent goes here...\n```\n\n### 2. Add a Non-Breaking Space at the Beginning\n\n```markdown\n&nbsp;\n\n# Your heading should now render\nContent goes here...\n```\n\n### 3. Insert an HTML Comment Before Content\n\n```markdown\n<!-- This comment helps establish context for the parser -->\n# Your heading should now render\nContent goes here...\n```\n\n## 🛠️ Solutions for HTML/Components\n\n### 1. Check Container Elements\n\nEnsure your container element is properly initialized:", "type": "text", "index": 1 } ], "tool_calls": [], "usage_metadata": { "input_tokens": 4040, "total_tokens": 4717, "output_tokens": 677 }, "response_metadata": { "llm": "us.anthropic.claude-3-7-sonnet-20250219-v1:0", "metrics": { "latencyMs": 21154 }, "stopReason": "end_turn" }, "invalid_tool_calls": [] } } } }, "parents": {}, "thread_id": "05e0c533-5074-4803-bd7c-b1afb82a1be4" }, "channel_values": [ [ "key", "msgpack", "91a7general" ], [ "general", "msgpack", "a7general" ], [ "messages", "msgpack", "dc0012c7d30594bdlangchain_core.messages.humanacHumanMessage87a7content9182a4typea4texta4textafteach me pythonb1additional_kwargs80b1response_metadata80a4typea5humana4namec0a2idd9$8b6d6bd9-c5ef-4db6-b9df-6071b7902dfaa7examplec2b3model_validate_jsonc8\r020594balangchain_core.messages.aia9AIMessage8aa7content9183a4typea4texta4textda0bv# f09f908d Python Programming Tutorial\n\nPython is one of the most popular and versatile programming languages in the world. It\"s great for beginners due to its simple, readable syntax while still being powerful enough for professional applications.\n\n## Getting Started with Python\n\n### Installation\n- Download Python from [python.org](https://www.python.org/downloads/)\n- son" ], [ "question", "msgpack", "86a7generald9Uabout the html markdown, first element is not rendering, rest all rendering correctlyaasynthesizec0a3cprc0a6devopsc0acdirect_salesc0a3pmoc0" ], [ "__start__", "empty", null ], [ "internal_messages", "msgpack", "90" ], [ "branch:main_message_filter:multimodalrouter:main_router_invoke", "empty", null ] ], "pending_writes": null } ```
yindo added the pull-request label 2026-02-20 17:50:24 -05:00
yindo closed this issue 2026-02-20 17:50:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4574