fix(langchain): set name on todoListMiddleware ToolMessages#10706
Merged
Christian Bromann (christian-bromann) merged 3 commits intoMay 19, 2026
Conversation
The todoListMiddleware built ToolMessages without a `name` field, which broke agents running against providers (e.g. Google Gemini) that require `name` on function responses. Once such a ToolMessage entered history, every subsequent request failed with a 400. All other ToolMessage producers in this package set `name`; align todoListMiddleware with that pattern and add regression coverage.
🦋 Changeset detectedLatest commit: d7f4bb0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Set name on todoListMiddleware ToolMessages for langchain.
Christian Bromann (christian-bromann)
approved these changes
May 19, 2026
Christian Bromann (christian-bromann)
left a comment
Member
There was a problem hiding this comment.
LGTM 👍
Thank you!
4ecb660
into
langchain-ai:main
38 of 39 checks passed
Christian Bromann (christian-bromann)
pushed a commit
that referenced
this pull request
May 21, 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/mistralai@1.1.0 ### Minor Changes - [#10873](#10873) [`a74d574`](a74d574) Thanks [@baptistejamin](https://github.com/baptistejamin)! - chore(mistralai): upgrade to @mistralai/mistralai v2 Also populates `response_metadata.model` on chat completions (was missing before). ## @langchain/openrouter@0.3.0 ### Minor Changes - [#10666](#10666) [`2bb55b0`](2bb55b0) Thanks [@hnustwjj](https://github.com/hnustwjj)! - feat(openrouter): surface reasoning content as v1 standard content blocks `convertOpenRouterResponseToBaseMessage` and `convertOpenRouterDeltaToBaseMessageChunk` now copy OpenRouter's `reasoning` (flat string) and `reasoning_details` (structured array) fields onto `additional_kwargs.reasoning_content` / `additional_kwargs.reasoning_details`. A new `ChatOpenRouterTranslator` is registered in `@langchain/core` under the `"openrouter"` provider key so `AIMessage.contentBlocks` emits standard `{type: "reasoning"}` blocks alongside text and tool calls. Previously, reasoning text returned by reasoning-capable models routed through OpenRouter (DeepSeek R1, Minimax M2, Claude extended thinking, o-series, etc.) was silently dropped: only the `reasoning_tokens` count was preserved via `usage_metadata`. Consumers using standard content blocks (including the frontend agent UI patterns shown in the docs) could not display the model's chain of thought. ### Patch Changes - [#10832](#10832) [`1b24369`](1b24369) Thanks [@info-arnav](https://github.com/info-arnav)! - fix(core, openrouter): make CJS default re-exports callable - Updated dependencies \[[`3999fab`](3999fab), [`fce9ab4`](fce9ab4)]: - @langchain/openai@1.4.7 ## langchain@1.4.2 ### Patch Changes - [#10900](#10900) [`6bbddca`](6bbddca) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(langchain): unwrap tool message outputs in agent streams - [#10706](#10706) [`4ecb660`](4ecb660) Thanks [@JadenKim-dev](https://github.com/JadenKim-dev)! - fix(langchain): set name on todoListMiddleware ToolMessages ## @langchain/classic@1.0.34 ### Patch Changes - Updated dependencies \[[`3999fab`](3999fab), [`fce9ab4`](fce9ab4)]: - @langchain/openai@1.4.7 ## @langchain/core@1.1.48 ### Patch Changes - [#10832](#10832) [`1b24369`](1b24369) Thanks [@info-arnav](https://github.com/info-arnav)! - fix(core, openrouter): make CJS default re-exports callable - [#10666](#10666) [`2bb55b0`](2bb55b0) Thanks [@hnustwjj](https://github.com/hnustwjj)! - feat(openrouter): surface reasoning content as v1 standard content blocks `convertOpenRouterResponseToBaseMessage` and `convertOpenRouterDeltaToBaseMessageChunk` now copy OpenRouter's `reasoning` (flat string) and `reasoning_details` (structured array) fields onto `additional_kwargs.reasoning_content` / `additional_kwargs.reasoning_details`. A new `ChatOpenRouterTranslator` is registered in `@langchain/core` under the `"openrouter"` provider key so `AIMessage.contentBlocks` emits standard `{type: "reasoning"}` blocks alongside text and tool calls. Previously, reasoning text returned by reasoning-capable models routed through OpenRouter (DeepSeek R1, Minimax M2, Claude extended thinking, o-series, etc.) was silently dropped: only the `reasoning_tokens` count was preserved via `usage_metadata`. Consumers using standard content blocks (including the frontend agent UI patterns shown in the docs) could not display the model's chain of thought. - [#10918](#10918) [`3999fab`](3999fab) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(openai): stream custom tool calls through Responses API chunks ## @langchain/aws@1.3.9 ### Patch Changes - [#10743](#10743) [`6e4337f`](6e4337f) Thanks [@Zelys-DFKH](https://github.com/Zelys-DFKH)! - fix(aws): add claude-haiku-4 to supportedToolChoiceValuesForModel ## @langchain/deepseek@1.0.27 ### Patch Changes - [#10747](#10747) [`78e642f`](78e642f) Thanks [@neo1027144-creator](https://github.com/neo1027144-creator)! - feat(deepseek): add DeepSeek V4 Flash and V4 Pro model profiles - Updated dependencies \[[`3999fab`](3999fab), [`fce9ab4`](fce9ab4)]: - @langchain/openai@1.4.7 ## @langchain/fireworks@0.1.5 ### Patch Changes - Updated dependencies \[[`3999fab`](3999fab), [`fce9ab4`](fce9ab4)]: - @langchain/openai@1.4.7 ## @langchain/ibm@0.1.1 ### Patch Changes - [#10721](#10721) [`20f27df`](20f27df) Thanks [@peterzaccha](https://github.com/peterzaccha)! - fix(langchain-ibm): handle API errors in streaming responses ## @langchain/neo4j@0.1.6 ### Patch Changes - Updated dependencies \[]: - @langchain/classic@1.0.34 ## @langchain/openai@1.4.7 ### Patch Changes - [#10918](#10918) [`3999fab`](3999fab) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(openai): stream custom tool calls through Responses API chunks - [#10791](#10791) [`fce9ab4`](fce9ab4) Thanks [@Genmin](https://github.com/Genmin)! - fix(openai): preserve top-level Responses API ids on AI messages ## @langchain/together-ai@0.1.5 ### Patch Changes - Updated dependencies \[[`3999fab`](3999fab), [`fce9ab4`](fce9ab4)]: - @langchain/openai@1.4.7 ## @langchain/xai@1.3.19 ### Patch Changes - Updated dependencies \[[`3999fab`](3999fab), [`fce9ab4`](fce9ab4)]: - @langchain/openai@1.4.7 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
todoListMiddlewarebuiltToolMessages without anamefield, which Gemini rejects with a 400. Once such a message enters history, every later turn in the session keeps failing.name: "write_todos"at both ToolMessage construction sites in todoListMiddleware.ts, aligning with every other ToolMessage producer in the packageFixes #10705
Test plan
pnpm vitest run src/agents/middleware/tests/todoList.test.ts(7 passed)