Skip to content

fix(langgraph-checkpoint-sqlite): honor WRITES_IDX_MAP for special channels in putWrites#2516

Merged
Christian Bromann (christian-bromann) merged 1 commit into
langchain-ai:mainfrom
jackjin1997:fix/sqlite-checkpoint-putwrites-special-channel-idx
Jun 10, 2026
Merged

fix(langgraph-checkpoint-sqlite): honor WRITES_IDX_MAP for special channels in putWrites#2516
Christian Bromann (christian-bromann) merged 1 commit into
langchain-ai:mainfrom
jackjin1997:fix/sqlite-checkpoint-putwrites-special-channel-idx

Conversation

@jackjin1997

Copy link
Copy Markdown
Contributor

Summary

SqliteSaver.putWrites stored every write at the call-local ordinal idx, ignoring WRITES_IDX_MAP. So when an INTERRUPT (or ERROR / SCHEDULED / RESUME) followed a regular write for the same task, both landed at idx=0 and the table PK (thread_id, checkpoint_ns, checkpoint_id, task_id, idx) collided — INSERT OR REPLACE silently dropped the regular write.

Other checkpointer implementations (Memory in libs/checkpoint, Postgres) and the Python SQLite checkpointer (langgraph/checkpoint/sqlite/__init__.py) all pin special channels to fixed negative indices via WRITES_IDX_MAP so they can't collide with per-step regular writes.

Cross-impl parity before this PR

Checkpointer WRITES_IDX_MAP Conflict clause
Memory (TS) gated by idx >= 0
Postgres (TS) OR REPLACE vs INSERT based on all special
Python SQLite OR REPLACE vs OR IGNORE based on all special
TS SQLite always OR REPLACE

Fix

  1. idx resolves to WRITES_IDX_MAP[channel] ?? idx.
  2. Statement switches between INSERT OR REPLACE and INSERT OR IGNORE depending on whether every write targets a special channel, matching langgraph/checkpoint/sqlite/__init__.py. INTERRUPT→RESUME state transitions overwrite (both special); concurrent tasks can't clobber each other's regular writes at the same idx.

Tests

New regression test interleaves regular and special-channel writes across two tasks (task_A does regular writes → INTERRUPT → RESUME, task_B does a regular write). All five logical writes survive getTuple().pendingWrites.

Reverse-verified: without the fix, task_A:foo and task_A:__interrupt__ both disappear from the round-trip — the test fails with Set { task_A:__resume__, task_A:bar, task_B:baz }.

AI Disclosure

This bug was identified via cross-implementation review against the Python SQLite checkpointer and TS MemorySaver / PostgresSaver, with AI assistance. The fix mirrors the Python reference implementation.

…annels in putWrites

`SqliteSaver.putWrites` stored every write at the ordinal `idx` within the
call, ignoring `WRITES_IDX_MAP`. So a follow-up
`putWrites([[INTERRUPT, value]], taskId)` for the same checkpoint computed
`idx=0` and the table's PK
`(thread_id, checkpoint_ns, checkpoint_id, task_id, idx)` collided with the
task's first regular write — `INSERT OR REPLACE` silently dropped the
existing row. Same issue for ERROR / SCHEDULED / RESUME. Other checkpointer
implementations (Memory in `libs/checkpoint`, Postgres) and the Python
SQLite checkpointer all map special channels onto negative indices via
`WRITES_IDX_MAP` so they can't collide with per-step regular writes.

Two changes here:

- `idx` now resolves to `WRITES_IDX_MAP[channel] ?? idx`, matching
  `BaseCheckpointSaver.put_writes` semantics.
- The statement switches between `INSERT OR REPLACE` and `INSERT OR IGNORE`
  depending on whether every write targets a special channel, matching
  `langgraph/checkpoint/sqlite/__init__.py`. This lets INTERRUPT→RESUME state
  transitions overwrite, while preventing a regular write from one task from
  clobbering another task's regular write at the same idx.

Added a regression test that interleaves regular and special-channel writes
across two tasks; without the fix two of the five logical writes (`foo` and
`__interrupt__`) silently disappear from `getTuple().pendingWrites`.
@changeset-bot

changeset-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c226ab3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@langchain/langgraph-checkpoint-sqlite Patch

Not sure what this means? Click here to learn what changesets are.

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

@pkg-pr-new

pkg-pr-new Bot commented Jun 10, 2026

Copy link
Copy Markdown

Open in StackBlitz

@langchain/langgraph-checkpoint

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint@2516

@langchain/langgraph-checkpoint-mongodb

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint-mongodb@2516

@langchain/langgraph-checkpoint-postgres

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint-postgres@2516

@langchain/langgraph-checkpoint-redis

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint-redis@2516

@langchain/langgraph-checkpoint-sqlite

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint-sqlite@2516

@langchain/langgraph-checkpoint-validation

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-checkpoint-validation@2516

create-langgraph

npm i https://pkg.pr.new/langchain-ai/langgraphjs/create-langgraph@2516

@langchain/langgraph-api

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-api@2516

@langchain/langgraph-cli

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-cli@2516

@langchain/langgraph

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph@2516

@langchain/langgraph-cua

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-cua@2516

@langchain/langgraph-supervisor

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-supervisor@2516

@langchain/langgraph-swarm

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-swarm@2516

@langchain/langgraph-ui

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-ui@2516

@langchain/langgraph-sdk

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/langgraph-sdk@2516

@langchain/angular

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/angular@2516

@langchain/react

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/react@2516

@langchain/svelte

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/svelte@2516

@langchain/vue

npm i https://pkg.pr.new/langchain-ai/langgraphjs/@langchain/vue@2516

commit: c226ab3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot 👍

@christian-bromann Christian Bromann (christian-bromann) merged commit f6a6d26 into langchain-ai:main Jun 10, 2026
25 checks passed
Christian Bromann (christian-bromann) pushed a commit that referenced this pull request Jun 10, 2026
…hannels in putWrites (#2517)

## Summary

Follow-up to #2516 (which fixed the same bug for `SqliteSaver`).
`MongoDBSaver.putWrites` stored every write at the call-local ordinal
`idx` and always used `$set`, ignoring `WRITES_IDX_MAP`. So:

- A follow-up `putWrites([[INTERRUPT, value]], taskId)` for the same
checkpoint computed `idx=0` and collided with the task's first regular
write — the unconditional `$set` upsert silently overwrote whichever row
landed there first.
- A mixed call `putWrites([[foo, …], [bar, …], [INTERRUPT, …]], taskId)`
shifted the INTERRUPT to idx=2, where a peer task storing a regular
write at the same idx for the same task_id would clobber it.

The fix mirrors `BaseCheckpointSaver.put_writes` semantics and the
Postgres / SQLite (TS and Python) implementations.

### Cross-impl parity after this PR

| Checkpointer | `WRITES_IDX_MAP` | Conflict clause |
|---|---|---|
| Memory (TS) | ✅ | gated by `idx >= 0` |
| Postgres (TS) | ✅ | `OR REPLACE` vs `INSERT` based on `all special` |
| SQLite (TS, #2516) | ✅ | `OR REPLACE` vs `OR IGNORE` based on `all
special` |
| **MongoDB (TS, this PR)** | ✅ | `$set` vs `$setOnInsert` based on `all
special` |
| Redis (TS) | ❌ | follow-up needed |

### Fix

1. `idx` resolves to `WRITES_IDX_MAP[channel] ?? idx`, so ERROR /
SCHEDULED / INTERRUPT / RESUME land at fixed negative indices that can't
collide with per-step regular writes.
2. The update operator switches between `$set` and `$setOnInsert`
depending on whether every write targets a special channel. State
transitions like INTERRUPT → RESUME still overwrite (both special); a
regular write from one task can never silently overwrite another
concurrent task's regular write at the same idx.

When timestamps are enabled, the `$setOnInsert` path also defers
`upserted_at` to insert-only, so a no-op upsert against a peer task's
existing row doesn't bump that row's "last modified" stamp.

### Tests

Mock-based unit test (no real MongoDB needed) captures `bulkWrite`
operations and asserts:
- Mixed regular + INTERRUPT batch → indices `[-3, 0, 1]` (vs the pre-fix
`[0, 1, 2]`) and every op uses `$setOnInsert`.
- Special-only batch (RESUME) → idx `-4` and uses `$set`.

**Reverse-verified**: with the fix reverted the test fails with
`Received [0, 1, 2]`.

## AI Disclosure

Identified via cross-implementation review against the SQLite fix in
#2516 — same root cause class, separate test surface.
Christian Bromann (christian-bromann) pushed a commit that referenced this pull request Jun 10, 2026
…nnels in putWrites (#2518)

## Summary

Third in the series following #2516 (SQLite) and #2517 (MongoDB).
`RedisSaver.putWrites` stored each write at the call-local ordinal `idx`
— the key suffix in `checkpoint_write:<thread>:<ns>:<ckpt>:<task>:<idx>`
was just the loop index — and always used unguarded `JSON.SET`, ignoring
`WRITES_IDX_MAP`.

- A follow-up `putWrites([[INTERRUPT, value]], taskId)` for the same
checkpoint computed `idx=0` and collided with the task's first regular
write key; the unconditional `JSON.SET` silently overwrote whichever row
landed there first.
- A mixed call like `[[foo, …], [bar, …], [INTERRUPT, …]]` shifted the
INTERRUPT to idx=2, where a peer task storing a regular write at the
same idx for the same task_id would clobber it.

### Cross-impl parity after this PR

| Checkpointer | `WRITES_IDX_MAP` | Conflict clause |
|---|---|---|
| Memory (TS) | ✅ | gated by `idx >= 0` |
| Postgres (TS) | ✅ | `OR REPLACE` vs `INSERT` based on `all special` |
| SQLite (TS, #2516) | ✅ | `OR REPLACE` vs `OR IGNORE` based on `all
special` |
| MongoDB (TS, #2517) | ✅ | `$set` vs `$setOnInsert` based on `all
special` |
| **Redis (TS, this PR)** | ✅ | `JSON.SET` vs `JSON.SET … NX` based on
`all special` |

### Fix

1. Key suffix now resolves to `WRITES_IDX_MAP[channel] ?? idx`, so ERROR
/ SCHEDULED / INTERRUPT / RESUME land at fixed negative indices that
can't collide with per-step regular writes.
2. The `JSON.SET` call switches between unguarded and the `NX` modifier
depending on whether every write targets a special channel. State
transitions like INTERRUPT → RESUME still overwrite (both special); a
regular write from one task can never silently overwrite another
concurrent task's regular write at the same idx.

### Tests

Mock-based unit test in a new `putWrites.test.ts` (no Redis needed)
captures every `client.json.set` call site and asserts:

- Mixed regular + INTERRUPT batch → key tails `[-3, 0, 1]` (vs the
pre-fix `[0, 1, 2]`) and every JSON.SET carries `{ NX: true }`.
- Special-only batch (RESUME) → key tail `-4` and no NX (so state
transitions can overwrite).

**Reverse-verified**: with the fix reverted both new tests fail.

## AI Disclosure

Identified via cross-implementation review against #2516 and #2517 —
same root cause class, different storage layer.
Christian Bromann (christian-bromann) pushed a commit that referenced this pull request Jun 10, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @langchain/langgraph-checkpoint@1.1.0

### Minor Changes

- [#2452](#2452)
[`a8e7659`](a8e7659)
Thanks [@christian-bromann](https://github.com/christian-bromann)! - Add
`DeltaChannel` and the writes-history saver API (beta).

`DeltaChannel` is a reducer channel that stores only a sentinel in
checkpoint
blobs instead of the full accumulated value, reconstructing state on
read by
replaying ancestor writes through a batch reducer. This avoids
re-serializing
the entire accumulated value at every step (e.g. long message
histories).

- `DeltaChannel(reducer, { snapshotFrequency })` in
`@langchain/langgraph` —
count-based snapshot cadence (default `snapshotFrequency=1000`) plus a
system bound `DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT` (default 5000, env
        `LANGGRAPH_DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT`).
- `messagesDeltaReducer` — a batching-invariant messages reducer that
coerces
        raw object/string writes, for use with `DeltaChannel`.
- `BaseCheckpointSaver.getDeltaChannelHistory({ config, channels })`
(beta) —
walks the parent chain returning per-channel `{ writes, seed? }`, with a
        direct-storage override in `MemorySaver`.
- `counters_since_delta_snapshot` added to `CheckpointMetadata`;
`DeltaSnapshot`
        serialization support in the JSON+ serializer.

Reconstruction is wired through the Pregel read/execution paths
(initialization,
`getState`, `updateState`, local reads) and `exit` durability
accumulates and
anchors delta writes so threads remain reconstructible without forcing
    snapshots.

### Patch Changes

- [#2450](#2450)
[`2f6d873`](2f6d873)
Thanks [@christian-bromann](https://github.com/christian-bromann)! - Add
node-level timeouts.

A `timeout` option is now supported on `StateGraph.addNode`, the
functional API
(`task`/`entrypoint`), and the `Send` constructor. Pass a number of
milliseconds
    for a hard wall-clock cap, or a `TimeoutPolicy` for finer control:

    ```ts
    import { TimeoutPolicy } from "@langchain/langgraph";

    // hard wall-clock cap on each attempt
    builder.addNode("agent", agentFn, { timeout: 60_000 });

    // full control
    builder.addNode("agent", agentFn, {
      timeout: {
        runTimeout: 60_000, // hard wall-clock cap, never refreshed
        idleTimeout: 10_000, // cap on time without observable progress
        refreshOn: "auto", // "auto" | "heartbeat"
      },
    });

    // per-task override
    new Send("agent", state, { timeout: { idleTimeout: 5_000 } });
    ```

    When a timeout fires, a `NodeTimeoutError` (carrying `node`, `kind`
(`"run"`/`"idle"`), `timeout`, `elapsed`, `runTimeout`, `idleTimeout`)
is raised,
the attempt's buffered writes are dropped, and the node's `AbortSignal`
is
aborted. `idleTimeout` is refreshed by observable progress (writes,
custom
stream-writer calls, child-task scheduling, callback events) or an
explicit
    `runtime.heartbeat()` call. The timer resets per retry attempt, and
    `NodeTimeoutError` is retryable under the default retry policy.

Ports langchain-ai/langgraph#7599,
[#7646](https://github.com/langchain-ai/langgraphjs/issues/7646), and
[#7659](https://github.com/langchain-ai/langgraphjs/issues/7659).

## @langchain/langgraph@1.4.0

### Minor Changes

- [#2449](#2449)
[`d12d269`](d12d269)
Thanks [@christian-bromann](https://github.com/christian-bromann)! - Add
cooperative, between-superstep graph draining via `RunControl`.

    A new `RunControl` (exported from `@langchain/langgraph`) exposes
`requestDrain(reason)` plus read-only `drainRequested` / `drainReason`.
Pass it
through the new `control` option on `invoke` / `stream` / `streamEvents`
(and the
functional API). It is surfaced on `runtime.control`, so nodes can read
it or call
    `requestDrain()` themselves, and it is propagated into subgraphs.

When a drain is requested, the Pregel loop checks the flag at the top of
each
superstep (after the previous step's writes are applied and
checkpointed): if more
tasks remain it saves the checkpoint and throws the new `GraphDrained`
error (also
under `durability: "exit"`), so the run can be resumed later from the
same config.
If the graph naturally finishes on that tick it returns normally and the
caller can
inspect `control.drainRequested`. A drain requested inside a subgraph
bubbles up and
stops the parent at its next boundary. Draining never cancels work that
is already
running — pair it with an `AbortSignal` if you need a hard upper bound.

- [#2452](#2452)
[`a8e7659`](a8e7659)
Thanks [@christian-bromann](https://github.com/christian-bromann)! - Add
`DeltaChannel` and the writes-history saver API (beta).

`DeltaChannel` is a reducer channel that stores only a sentinel in
checkpoint
blobs instead of the full accumulated value, reconstructing state on
read by
replaying ancestor writes through a batch reducer. This avoids
re-serializing
the entire accumulated value at every step (e.g. long message
histories).

- `DeltaChannel(reducer, { snapshotFrequency })` in
`@langchain/langgraph` —
count-based snapshot cadence (default `snapshotFrequency=1000`) plus a
system bound `DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT` (default 5000, env
        `LANGGRAPH_DELTA_MAX_SUPERSTEPS_SINCE_SNAPSHOT`).
- `messagesDeltaReducer` — a batching-invariant messages reducer that
coerces
        raw object/string writes, for use with `DeltaChannel`.
- `BaseCheckpointSaver.getDeltaChannelHistory({ config, channels })`
(beta) —
walks the parent chain returning per-channel `{ writes, seed? }`, with a
        direct-storage override in `MemorySaver`.
- `counters_since_delta_snapshot` added to `CheckpointMetadata`;
`DeltaSnapshot`
        serialization support in the JSON+ serializer.

Reconstruction is wired through the Pregel read/execution paths
(initialization,
`getState`, `updateState`, local reads) and `exit` durability
accumulates and
anchors delta writes so threads remain reconstructible without forcing
    snapshots.

- [#2451](#2451)
[`d65a920`](d65a920)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
feat(langgraph): add node-level error handlers

`StateGraph.addNode(name, fn, { errorHandler })` now accepts a
first-class
node-level error handler. The handler runs ONLY after the failing node's
`retryPolicy` is exhausted, so retry and handling stay decoupled. It
receives a
typed `NodeError { node, error }` and the typed node input state, can
return a
state update, and can route to a recovery branch via `new Command({ goto
})`
    (saga / compensation flows).

Failure provenance is checkpointed (via a reserved `ERROR_SOURCE_NODE`
write) so
handlers observe the same context after a checkpoint resume. Uncaught
node
errors without a handler still abort the run as before, and
`GraphBubbleUp`
    errors (such as `interrupt()`) are never swallowed by a handler.

`StateGraph.setNodeDefaults({ errorHandler })` now also accepts a
graph-wide
default handler. It is materialized at `compile()` as a single shared
handler
and invoked for every regular node that does not set its own
`errorHandler`. A
per-node handler always takes precedence, the default never catches a
failure
raised by an error-handler node itself (handler failures fail the run),
and the
    default is not inherited by subgraphs.

    Ports the Python feature from langchain-ai/langgraph#7233.

- [#2450](#2450)
[`2f6d873`](2f6d873)
Thanks [@christian-bromann](https://github.com/christian-bromann)! - Add
node-level timeouts.

A `timeout` option is now supported on `StateGraph.addNode`, the
functional API
(`task`/`entrypoint`), and the `Send` constructor. Pass a number of
milliseconds
    for a hard wall-clock cap, or a `TimeoutPolicy` for finer control:

    ```ts
    import { TimeoutPolicy } from "@langchain/langgraph";

    // hard wall-clock cap on each attempt
    builder.addNode("agent", agentFn, { timeout: 60_000 });

    // full control
    builder.addNode("agent", agentFn, {
      timeout: {
        runTimeout: 60_000, // hard wall-clock cap, never refreshed
        idleTimeout: 10_000, // cap on time without observable progress
        refreshOn: "auto", // "auto" | "heartbeat"
      },
    });

    // per-task override
    new Send("agent", state, { timeout: { idleTimeout: 5_000 } });
    ```

    When a timeout fires, a `NodeTimeoutError` (carrying `node`, `kind`
(`"run"`/`"idle"`), `timeout`, `elapsed`, `runTimeout`, `idleTimeout`)
is raised,
the attempt's buffered writes are dropped, and the node's `AbortSignal`
is
aborted. `idleTimeout` is refreshed by observable progress (writes,
custom
stream-writer calls, child-task scheduling, callback events) or an
explicit
    `runtime.heartbeat()` call. The timer resets per retry attempt, and
    `NodeTimeoutError` is retryable under the default retry policy.

Ports langchain-ai/langgraph#7599,
[#7646](https://github.com/langchain-ai/langgraphjs/issues/7646), and
[#7659](https://github.com/langchain-ai/langgraphjs/issues/7659).

- [#2461](#2461)
[`801d955`](801d955)
Thanks [@christian-bromann](https://github.com/christian-bromann)! - Add
`StateGraph.setNodeDefaults()` for setting graph-wide node policy
defaults (`retryPolicy`, `cachePolicy`). Per-node values passed to
`addNode` always take precedence, and defaults are resolved at
`compile()` time so call order does not matter. Defaults are not
inherited by subgraphs. Ports Python's `set_node_defaults()`
(langchain-ai/langgraph#7747).

### Patch Changes

- [#2179](#2179)
[`01c67df`](01c67df)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
fix(core): time travel replay/fork for graphs with interrupts and
subgraphs

Ports Python fixes for stale RESUME writes during replay, wrong subgraph
checkpoint loading during time travel, missing fork checkpoints on
replay, and direct-to-subgraph time travel.

- [#2514](#2514)
[`9e0201d`](9e0201d)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
fix(schema): expose StateSchema JSON schemas for Studio introspection

    Route StateSchema runtime definitions through getJsonSchema() and
    getInputJsonSchema() so LangGraph Studio receives state, input, and
    context schemas when graphs use the StateSchema primitive.

Fixes [#2466](#2466)

- [#2471](#2471)
[`9b96f60`](9b96f60)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
perf(core): skip debug checkpoint snapshots when not streaming them

Avoid building full-state `mapDebugCheckpoint` payloads on every tick
when
    no consumer subscribed to `checkpoints` or `debug` stream modes. v3
companion checkpoint envelopes are unchanged (they come from values
metadata).

- [#2472](#2472)
[`8e06ace`](8e06ace)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
perf(core): index pending writes for O(1) task-prep lookups

Build a PendingWritesIndex once per \_prepareNextTasks call so resume
and
skip-done-task checks avoid repeated linear scans over
checkpointPendingWrites.

- [#2473](#2473)
[`a8b0036`](a8b0036)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
perf(core): optimize applyWrites, interrupt seen, and channel errors

Reduce allocations in \_applyWrites, fix O(N²) interrupt versions_seen
updates,
skip stack traces on EmptyChannelError control flow, and cache task
lists in
    the pregel loop and runner.

- [#2444](#2444)
[`4096933`](4096933)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
feat(remote): add RemoteGraph v3 streaming support

Expose the v3 `streamEvents` surface for `RemoteGraph` by adapting
remote SDK thread streams to the local `GraphRunStream` shape.

- Updated dependencies
\[[`a8e7659`](a8e7659),
[`2f6d873`](2f6d873)]:
    -   @langchain/langgraph-checkpoint@1.1.0

## @langchain/langgraph-checkpoint-mongodb@1.3.4

### Patch Changes

- [#2517](#2517)
[`67a4f8d`](67a4f8d)
Thanks [@jackjin1997](https://github.com/jackjin1997)! - fix:
`MongoDBSaver.putWrites` now honors `WRITES_IDX_MAP`, pinning special
channels (`__error__`, `__scheduled__`, `__interrupt__`, `__resume__`)
to fixed negative indices instead of the call-local ordinal. Previously
a mixed `putWrites([[...regular...], [INTERRUPT, …]], taskId)` placed
the INTERRUPT at a positive idx that could collide with a regular write
at the same `(task_id, idx)`, and the unconditional `$set` upsert
silently overwrote whichever row landed there first. The
conflict-resolution clause now matches the Postgres / SQLite (TS and
Python) checkpointers: `$set` only when every channel is a special one,
`$setOnInsert` otherwise.

## @langchain/langgraph-checkpoint-postgres@1.0.3

### Patch Changes

- [#2512](#2512)
[`375c73f`](375c73f)
Thanks [@jackjin1997](https://github.com/jackjin1997)! - fix: reject SQL
`LIKE` wildcards (`%`, `_`) and the backslash escape character in
`PostgresStore` namespace labels. `BaseStore.search()` matches
namespaces via `namespace_path LIKE ${prefix}%`, and these characters in
caller-supplied namespace labels are interpreted as wildcards by
Postgres even through a bound parameter — letting a namespace prefix of
`["%"]` match every namespace in the store across tenants.
`validateNamespace` now throws for these characters at all `search` /
`get` / `put` entrypoints, keeping store-wide consistency. CWE-1336.

## @langchain/langgraph-checkpoint-redis@1.0.8

### Patch Changes

- [#2518](#2518)
[`9182ea3`](9182ea3)
Thanks [@jackjin1997](https://github.com/jackjin1997)! - fix:
`RedisSaver.putWrites` now honors `WRITES_IDX_MAP`, pinning special
channels (`__error__`, `__scheduled__`, `__interrupt__`, `__resume__`)
to fixed negative indices in their Redis key
(`checkpoint_write:…:<idx>`) instead of the call-local ordinal.
Previously a mixed `putWrites([[…regular…], [INTERRUPT, …]], taskId)`
placed the INTERRUPT key at the positive idx of its position in the
batch, where a peer task's regular write at the same idx would overwrite
it via the unconditional `JSON.SET`. The conflict-resolution clause now
matches Postgres / SQLite / MongoDB: unguarded `JSON.SET` when every
write is a special channel, `JSON.SET … NX` (insert-or-ignore)
otherwise.

## @langchain/langgraph-checkpoint-sqlite@1.0.3

### Patch Changes

- [#2516](#2516)
[`f6a6d26`](f6a6d26)
Thanks [@jackjin1997](https://github.com/jackjin1997)! - fix:
`SqliteSaver.putWrites` now honors `WRITES_IDX_MAP`, pinning special
channels (`__error__`, `__scheduled__`, `__interrupt__`, `__resume__`)
to fixed negative indices instead of the call-local ordinal. Previously
a follow-up `putWrites([[INTERRUPT, …]], taskId)` for the same
checkpoint silently `REPLACE`d the regular write previously stored at
`idx=0` for that task, losing data. The conflict-resolution clause also
now matches the Python checkpointer contract: `OR REPLACE` only when
every channel is a special one (so e.g. INTERRUPT→RESUME state
transitions overwrite), `OR IGNORE` otherwise.

## @langchain/angular@1.0.21

### Patch Changes

- [#2515](#2515)
[`49b8c1a`](49b8c1a)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
fix: make AnyStream a true supertype so selector hooks need no cast

    A concrete `useStream<typeof agent>()` handle was not assignable to
    `AnyStream` because generic-computed covariant members (`toolCalls`,
`values`) don't widen under `any` — `InferToolCalls<any>[]` resolves to
`AssembledToolCall<…, never>[]`, narrower than a concrete handle.
Override
    those members with their widest forms (preserving each framework's
reactivity wrapper — plain arrays for React/Svelte, `ShallowRef` for
Vue,
`Signal` for Angular) so the message/tool/value selector hooks accept a
    fully-typed stream without an `as AnyStream` cast.

## @langchain/react@1.0.21

### Patch Changes

- [#2515](#2515)
[`49b8c1a`](49b8c1a)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
fix: make AnyStream a true supertype so selector hooks need no cast

    A concrete `useStream<typeof agent>()` handle was not assignable to
    `AnyStream` because generic-computed covariant members (`toolCalls`,
`values`) don't widen under `any` — `InferToolCalls<any>[]` resolves to
`AssembledToolCall<…, never>[]`, narrower than a concrete handle.
Override
    those members with their widest forms (preserving each framework's
reactivity wrapper — plain arrays for React/Svelte, `ShallowRef` for
Vue,
`Signal` for Angular) so the message/tool/value selector hooks accept a
    fully-typed stream without an `as AnyStream` cast.

## @langchain/svelte@1.0.21

### Patch Changes

- [#2515](#2515)
[`49b8c1a`](49b8c1a)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
fix: make AnyStream a true supertype so selector hooks need no cast

    A concrete `useStream<typeof agent>()` handle was not assignable to
    `AnyStream` because generic-computed covariant members (`toolCalls`,
`values`) don't widen under `any` — `InferToolCalls<any>[]` resolves to
`AssembledToolCall<…, never>[]`, narrower than a concrete handle.
Override
    those members with their widest forms (preserving each framework's
reactivity wrapper — plain arrays for React/Svelte, `ShallowRef` for
Vue,
`Signal` for Angular) so the message/tool/value selector hooks accept a
    fully-typed stream without an `as AnyStream` cast.

## @langchain/vue@1.0.21

### Patch Changes

- [#2515](#2515)
[`49b8c1a`](49b8c1a)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
fix: make AnyStream a true supertype so selector hooks need no cast

    A concrete `useStream<typeof agent>()` handle was not assignable to
    `AnyStream` because generic-computed covariant members (`toolCalls`,
`values`) don't widen under `any` — `InferToolCalls<any>[]` resolves to
`AssembledToolCall<…, never>[]`, narrower than a concrete handle.
Override
    those members with their widest forms (preserving each framework's
reactivity wrapper — plain arrays for React/Svelte, `ShallowRef` for
Vue,
`Signal` for Angular) so the message/tool/value selector hooks accept a
    fully-typed stream without an `as AnyStream` cast.

## @example/ai-elements@0.1.36

### Patch Changes

- Updated dependencies
\[[`01c67df`](01c67df),
[`d12d269`](d12d269),
[`a8e7659`](a8e7659),
[`49b8c1a`](49b8c1a),
[`9e0201d`](9e0201d),
[`9b96f60`](9b96f60),
[`8e06ace`](8e06ace),
[`d65a920`](d65a920),
[`2f6d873`](2f6d873),
[`a8b0036`](a8b0036),
[`4096933`](4096933),
[`801d955`](801d955)]:
    -   @langchain/langgraph@1.4.0
    -   @langchain/react@1.0.21

## @examples/assistant-ui-claude@0.1.36

### Patch Changes

- Updated dependencies
\[[`01c67df`](01c67df),
[`d12d269`](d12d269),
[`a8e7659`](a8e7659),
[`49b8c1a`](49b8c1a),
[`9e0201d`](9e0201d),
[`9b96f60`](9b96f60),
[`8e06ace`](8e06ace),
[`d65a920`](d65a920),
[`2f6d873`](2f6d873),
[`a8b0036`](a8b0036),
[`4096933`](4096933),
[`801d955`](801d955)]:
    -   @langchain/langgraph@1.4.0
    -   @langchain/react@1.0.21

## @examples/ui-angular@0.0.46

### Patch Changes

- Updated dependencies
\[[`01c67df`](01c67df),
[`d12d269`](d12d269),
[`a8e7659`](a8e7659),
[`49b8c1a`](49b8c1a),
[`9e0201d`](9e0201d),
[`9b96f60`](9b96f60),
[`8e06ace`](8e06ace),
[`d65a920`](d65a920),
[`2f6d873`](2f6d873),
[`a8b0036`](a8b0036),
[`4096933`](4096933),
[`801d955`](801d955)]:
    -   @langchain/langgraph@1.4.0
    -   @langchain/angular@1.0.21

## @examples/ui-multimodal@0.0.22

### Patch Changes

- Updated dependencies
\[[`01c67df`](01c67df),
[`d12d269`](d12d269),
[`a8e7659`](a8e7659),
[`49b8c1a`](49b8c1a),
[`9e0201d`](9e0201d),
[`9b96f60`](9b96f60),
[`8e06ace`](8e06ace),
[`d65a920`](d65a920),
[`2f6d873`](2f6d873),
[`a8b0036`](a8b0036),
[`4096933`](4096933),
[`801d955`](801d955)]:
    -   @langchain/langgraph@1.4.0
    -   @langchain/react@1.0.21

## @examples/ui-react@0.0.22

### Patch Changes

- Updated dependencies
\[[`01c67df`](01c67df),
[`d12d269`](d12d269),
[`a8e7659`](a8e7659),
[`49b8c1a`](49b8c1a),
[`9e0201d`](9e0201d),
[`9b96f60`](9b96f60),
[`8e06ace`](8e06ace),
[`d65a920`](d65a920),
[`2f6d873`](2f6d873),
[`a8b0036`](a8b0036),
[`4096933`](4096933),
[`801d955`](801d955)]:
    -   @langchain/langgraph@1.4.0
    -   @langchain/react@1.0.21

## langgraph@1.0.40

### Patch Changes

- Updated dependencies
\[[`01c67df`](01c67df),
[`d12d269`](d12d269),
[`a8e7659`](a8e7659),
[`9e0201d`](9e0201d),
[`9b96f60`](9b96f60),
[`8e06ace`](8e06ace),
[`d65a920`](d65a920),
[`2f6d873`](2f6d873),
[`a8b0036`](a8b0036),
[`4096933`](4096933),
[`801d955`](801d955)]:
    -   @langchain/langgraph@1.4.0

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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