Skip to content

fix(langgraph): recognize JSON-erased Overwrite values across runtimes#2553

Merged
Christian Bromann (christian-bromann) merged 1 commit into
mainfrom
cb/fix-overwrite-json-discriminator
Jun 17, 2026
Merged

fix(langgraph): recognize JSON-erased Overwrite values across runtimes#2553
Christian Bromann (christian-bromann) merged 1 commit into
mainfrom
cb/fix-overwrite-json-discriminator

Conversation

@christian-bromann

Copy link
Copy Markdown
Member

Summary

  • JS Overwrite already survives JSON serialization because Overwrite.toJSON() emits the canonical { "__overwrite__": value } sentinel, which _getOverwriteValue recognizes.
  • This adds recognition of the discriminator form { "type": "__overwrite__", value } that results when a typed Overwrite from another runtime (notably a Python dataclass, post fix(langgraph): Make Overwrite survive JSON roundtrips langgraph#8127) is serialized through a JSON boundary and its type is erased.
  • Brings JS to full parity with Python's three-form _get_overwrite (instance, sentinel dict, discriminator dict), so Overwrite round-trips both directions across the JS↔Python API boundary. Delta-channel APIs remain Beta.

_getOverwriteValue now also accepts the { type: "__overwrite__", value }
discriminator form produced when a typed Overwrite from another runtime
(e.g. a Python dataclass routed through the LangGraph API server) is
serialized and its type is erased, keeping Overwrite/DeltaChannel
semantics intact across cross-runtime JSON boundaries.
@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cdc582d

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

This PR includes changesets to release 7 packages
Name Type
@langchain/langgraph Patch
@example/ai-elements Patch
@examples/assistant-ui-claude Patch
@examples/ui-angular Patch
@examples/ui-multimodal Patch
@examples/ui-react Patch
langgraph 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 17, 2026

Copy link
Copy Markdown

Open in StackBlitz

@langchain/langgraph-checkpoint

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

@langchain/langgraph-checkpoint-mongodb

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

@langchain/langgraph-checkpoint-postgres

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

@langchain/langgraph-checkpoint-redis

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

@langchain/langgraph-checkpoint-sqlite

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

@langchain/langgraph-checkpoint-validation

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

create-langgraph

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

@langchain/langgraph-api

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

@langchain/langgraph-cli

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

@langchain/langgraph

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

@langchain/langgraph-cua

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

@langchain/langgraph-supervisor

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

@langchain/langgraph-swarm

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

@langchain/langgraph-ui

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

@langchain/langgraph-sdk

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

@langchain/angular

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

@langchain/react

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

@langchain/svelte

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

@langchain/vue

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

commit: cdc582d

@open-swe open-swe Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Open SWE Review: No issues found

Open SWE reviewed this PR and found no potential bugs to report.

Open in WebView Open SWE trace

@christian-bromann Christian Bromann (christian-bromann) merged commit 1c2aa5b into main Jun 17, 2026
30 checks passed
@christian-bromann Christian Bromann (christian-bromann) deleted the cb/fix-overwrite-json-discriminator branch June 17, 2026 22:58
Christian Bromann (christian-bromann) pushed a commit that referenced this pull request Jun 17, 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@1.4.4

### Patch Changes

- [#2552](#2552)
[`d662cbb`](d662cbb)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
fix(langgraph): isolate concurrent singleton-agent invocations by thread

`ensureLangGraphConfig` ignores the ambient `AsyncLocalStorage`
`configurable`
on root-level invokes that supply an invoke-time `thread_id` and have no
nesting
keys (ignoring graph-bound `.withConfig()` defaults). On a fresh
top-level run
the ambient `configurable` can belong to another concurrent invocation,
so its
    keys — internal scratchpad/task-input as well as user keys like
`tenant_id`/`user_id` — must not leak in; values the caller wants arrive
through
the explicit (bound + invoke-time) configs. Ambient nesting
(`__pregel_read__`)
and bound child graphs invoked from parent tasks are unaffected. This
prevents
cross-invocation leakage between concurrent `invoke()` calls on a shared
compiled
graph (e.g. BullMQ workers with `concurrency > 1`). Complements the
config-merge
fix that stopped shared graph-bound `metadata`/`configurable` objects
from being
    mutated across invocations
    ([#2040](#2040)).

- [#2553](#2553)
[`1c2aa5b`](1c2aa5b)
Thanks [@christian-bromann](https://github.com/christian-bromann)! -
fix(langgraph): recognize JSON-erased `Overwrite` values across runtimes

`Overwrite` already survives JSON serialization in JS because
`Overwrite.toJSON()`
emits the canonical `{ "__overwrite__": value }` sentinel.
`_getOverwriteValue`
now additionally recognizes the discriminator form `{ "type":
"__overwrite__",
value }` produced when a typed `Overwrite` from another runtime (e.g. a
Python
dataclass routed through the LangGraph API server) is serialized and its
type is
erased. This keeps `Overwrite` (and `DeltaChannel`) semantics intact
across
cross-runtime JSON boundaries. These delta-channel APIs remain Beta.

## @example/ai-elements@0.1.40

### Patch Changes

- Updated dependencies
\[[`d662cbb`](d662cbb),
[`1c2aa5b`](1c2aa5b)]:
    -   @langchain/langgraph@1.4.4

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

### Patch Changes

- Updated dependencies
\[[`d662cbb`](d662cbb),
[`1c2aa5b`](1c2aa5b)]:
    -   @langchain/langgraph@1.4.4

## @examples/ui-angular@0.0.50

### Patch Changes

- Updated dependencies
\[[`d662cbb`](d662cbb),
[`1c2aa5b`](1c2aa5b)]:
    -   @langchain/langgraph@1.4.4

## @examples/ui-multimodal@0.0.26

### Patch Changes

- Updated dependencies
\[[`d662cbb`](d662cbb),
[`1c2aa5b`](1c2aa5b)]:
    -   @langchain/langgraph@1.4.4

## @examples/ui-react@0.0.26

### Patch Changes

- Updated dependencies
\[[`d662cbb`](d662cbb),
[`1c2aa5b`](1c2aa5b)]:
    -   @langchain/langgraph@1.4.4

## langgraph@1.0.44

### Patch Changes

- Updated dependencies
\[[`d662cbb`](d662cbb),
[`1c2aa5b`](1c2aa5b)]:
    -   @langchain/langgraph@1.4.4

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.

1 participant