Skip to content

feat(checkpoint-postgres): add task_path support and inline primitive merging#1967

Open
WilliamPeralta wants to merge 1 commit intolangchain-ai:mainfrom
WilliamPeralta:feat/checkpoint-postgres-task-path
Open

feat(checkpoint-postgres): add task_path support and inline primitive merging#1967
WilliamPeralta wants to merge 1 commit intolangchain-ai:mainfrom
WilliamPeralta:feat/checkpoint-postgres-task-path

Conversation

@WilliamPeralta
Copy link

@WilliamPeralta WilliamPeralta commented Feb 17, 2026

Summary

Port task_path support from the Python checkpoint-postgres implementation to bring JS to feature parity. This is a non-breaking change.

Changes:

  • Add migrations 5-9 (thread_id indexes + task_path column on checkpoint_writes)
  • Add optional taskPath parameter to putWrites() and _dumpWrites()
  • Update SQL INSERT/UPSERT statements to include task_path column
  • Update pending sends query ordering to sort by task_path, task_id, idx
  • Add read-side merging of inline primitive channel_values from checkpoint JSONB
  • Add integration tests for task_path and new migrations

Why:

The Python implementation added task_path to support deterministic ordering of pending sends from nested subgraphs and parallel branches. Without it, the JS implementation may aggregate pending sends in non-deterministic order, causing state corruption during replay/forking.

Backward compatibility:

  • task_path column has DEFAULT '' — all existing rows are valid
  • putWrites parameter is optional with default ""
  • Read-side primitive merging is additive (no-op for pure-JS checkpoints)
  • No changes to how data is written for existing callers

Test plan

  • Integration tests pass with pnpm test:int in libs/checkpoint-postgres
  • Verify migrations 5-9 run successfully on fresh DB
  • Verify putWrites works with and without taskPath parameter
  • Verify task_path column exists and defaults to empty string
  • Verify pending sends ordering includes task_path

… merging

Port task_path support from the Python checkpoint-postgres implementation
to bring JS to feature parity. This is a non-breaking change.

Changes:
- Add migrations 5-9 (thread_id indexes + task_path column on checkpoint_writes)
- Add optional taskPath parameter to putWrites() and _dumpWrites()
- Update SQL INSERT/UPSERT statements to include task_path column
- Update pending sends/writes query ordering to sort by task_path, task_id, idx
- Add read-side merging of inline primitive channel_values from checkpoint JSONB
- Add integration tests for task_path and new migrations

The Python implementation added task_path to support deterministic ordering
of pending sends from nested subgraphs and parallel branches. Without it,
the JS implementation may aggregate pending sends in non-deterministic order,
causing state corruption during replay/forking.

Backward compatibility:
- task_path column has DEFAULT '' - all existing rows are valid
- putWrites taskPath parameter is optional with default ""
- Read-side primitive merging is additive (no-op for pure-JS checkpoints)
- No changes to how data is written for existing callers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2026

⚠️ No Changeset found

Latest commit: 203956f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

WilliamPeralta added a commit to WilliamPeralta/langgraphjs that referenced this pull request Feb 17, 2026
… storage with Python

BREAKING: Align checkpoint version format and channel_values storage
with the Python implementation.

Breaking changes:

1. Version format: getNextVersion now produces zero-padded string
   versions (e.g. "00000000000000000000000000000001.0482910384729105")
   instead of integer versions (1, 2, 3).

   Migration impact: Existing checkpoints with integer versions will
   still be readable. New checkpoints will use string versions.

2. Inline primitives: Primitive channel values (string, number,
   boolean, null) are now stored inline in the checkpoint JSONB column
   instead of in checkpoint_blobs. Requires PR langchain-ai#1967 (read-side merge)
   to be deployed first, so existing readers can handle both formats.

These changes enable cross-compatibility between Python and JS
checkpoint implementations sharing the same database, required for
hybrid Python/JS LangGraph deployments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WilliamPeralta added a commit to WilliamPeralta/langgraph-checkpoint-postgres that referenced this pull request Feb 17, 2026
…s with Python parity fixes

Fixes branching bug (#1812), adds task_path support, inline primitives,
and globally unique version IDs.

Upstream PRs: langchain-ai/langgraphjs#1967, langchain-ai/langgraphjs#1968
WilliamPeralta added a commit to WilliamPeralta/langgraphjs that referenced this pull request Feb 24, 2026
… storage with Python

BREAKING: Align checkpoint version format and channel_values storage
with the Python implementation.

Breaking changes:

1. Version format: getNextVersion now produces zero-padded string
   versions (e.g. "00000000000000000000000000000001.0482910384729105")
   instead of integer versions (1, 2, 3).

   Migration impact: Existing checkpoints with integer versions will
   still be readable. New checkpoints will use string versions.

2. Inline primitives: Primitive channel values (string, number,
   boolean, null) are now stored inline in the checkpoint JSONB column
   instead of in checkpoint_blobs. Requires PR langchain-ai#1967 (read-side merge)
   to be deployed first, so existing readers can handle both formats.

These changes enable cross-compatibility between Python and JS
checkpoint implementations sharing the same database, required for
hybrid Python/JS LangGraph deployments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WilliamPeralta added a commit to WilliamPeralta/langgraphjs that referenced this pull request Mar 2, 2026
… storage with Python

BREAKING: Align checkpoint version format and channel_values storage
with the Python implementation.

Breaking changes:

1. Version format: getNextVersion now produces zero-padded string
   versions (e.g. "00000000000000000000000000000001.0482910384729105")
   instead of integer versions (1, 2, 3).

   Migration impact: Existing checkpoints with integer versions will
   still be readable. New checkpoints will use string versions.

2. Inline primitives: Primitive channel values (string, number,
   boolean, null) are now stored inline in the checkpoint JSONB column
   instead of in checkpoint_blobs. Requires PR langchain-ai#1967 (read-side merge)
   to be deployed first, so existing readers can handle both formats.

These changes enable cross-compatibility between Python and JS
checkpoint implementations sharing the same database, required for
hybrid Python/JS LangGraph deployments.
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.

1 participant