[PR #111] [CLOSED] Ensure register files reducer in Langgraph schemaMetaRegistry #133

Closed
opened 2026-02-16 06:17:14 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagentsjs/pull/111
Author: @brettshollenberger
Created: 1/12/2026
Status: Closed

Base: mainHead: files-reducer-bug


📝 Commits (1)

  • 41af0e5 Ensure register files reducer in Langgraph schemaMetaRegistry

📊 Changes

3 files changed (+7220 additions, -9 deletions)

View changed files

libs/deepagents/src/middleware/fs.reducer.test.ts (+50 -0)
📝 libs/deepagents/src/middleware/fs.ts (+7 -9)
package-lock.json (+7163 -0)

📄 Description

Bug

Related to https://github.com/langchain-ai/deepagentsjs/issues/52 and https://github.com/langchain-ai/deepagentsjs/issues/65 and https://github.com/langchain-ai/deepagentsjs/issues/75

Expectation

FS middleware should have custom reducer. Instead, it receives LastValue reducer. This means backends which return files to state receive the error: LastValue can only receive one value per step

Root Cause

Zod 4's .meta() stores metadata in Zod's internal globalRegistry, but LangGraph reads from its own separate schemaMetaRegistry. The reducer was being registered in the wrong place, so LangGraph couldn't find it and fell back to LastValue (single-value-only channel) instead of BinaryOperatorAggregate (merge reducer).

@christian-bromann since you've been looking at stuff related to this


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagentsjs/pull/111 **Author:** [@brettshollenberger](https://github.com/brettshollenberger) **Created:** 1/12/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `files-reducer-bug` --- ### 📝 Commits (1) - [`41af0e5`](https://github.com/langchain-ai/deepagentsjs/commit/41af0e5b0bbe555881f6ec756c38be71ed103836) Ensure register files reducer in Langgraph schemaMetaRegistry ### 📊 Changes **3 files changed** (+7220 additions, -9 deletions) <details> <summary>View changed files</summary> ➕ `libs/deepagents/src/middleware/fs.reducer.test.ts` (+50 -0) 📝 `libs/deepagents/src/middleware/fs.ts` (+7 -9) ➕ `package-lock.json` (+7163 -0) </details> ### 📄 Description ## Bug Related to https://github.com/langchain-ai/deepagentsjs/issues/52 and https://github.com/langchain-ai/deepagentsjs/issues/65 and https://github.com/langchain-ai/deepagentsjs/issues/75 ## Expectation FS middleware should have custom reducer. Instead, it receives `LastValue` reducer. This means backends which return files to state receive the error: `LastValue can only receive one value per step` ## Root Cause Zod 4's .meta() stores metadata in Zod's internal globalRegistry, but LangGraph reads from its own separate schemaMetaRegistry. The reducer was being registered in the wrong place, so LangGraph couldn't find it and fell back to LastValue (single-value-only channel) instead of BinaryOperatorAggregate (merge reducer). @christian-bromann since you've been looking at stuff related to this --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 06:17:14 -05:00
yindo closed this issue 2026-02-16 06:17:14 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#133