[GH-ISSUE #185] createSummarizationMiddleware logic error #43

Closed
opened 2026-02-16 06:16:57 -05:00 by yindo · 1 comment
Owner

Originally created by @zixingtangmouren on GitHub (Feb 4, 2026).
Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/185

Originally assigned to: @christian-bromann on GitHub.

Description

It seems that there is a logic issue in the createSummarizationMiddleware middleware in the main branch.

path: libs/deepagents/src/middleware/summarization.ts

    if (truncateTrigger.type === "fraction" && maxInputTokens) {
      const threshold = Math.floor(maxInputTokens * truncateTrigger.value);
      return totalTokens >= threshold;
    }

I pulled down the main branch to test it and found that the fraction parameter is always invalid because maxInputTokens is always undefined.

Originally created by @zixingtangmouren on GitHub (Feb 4, 2026). Original GitHub issue: https://github.com/langchain-ai/deepagentsjs/issues/185 Originally assigned to: @christian-bromann on GitHub. ## Description It seems that there is a logic issue in the `createSummarizationMiddleware` middleware in the main branch. path: libs/deepagents/src/middleware/summarization.ts ```ts if (truncateTrigger.type === "fraction" && maxInputTokens) { const threshold = Math.floor(maxInputTokens * truncateTrigger.value); return totalTokens >= threshold; } ``` I pulled down the main branch to test it and found that the fraction parameter is always invalid because maxInputTokens is always undefined.
yindo closed this issue 2026-02-16 06:16:57 -05:00
Author
Owner

@christian-bromann commented on GitHub (Feb 4, 2026):

Thanks for reporting, will take a look!

@christian-bromann commented on GitHub (Feb 4, 2026): Thanks for reporting, will take a look!
yindo changed title from `createSummarizationMiddleware` logic error to [GH-ISSUE #185] `createSummarizationMiddleware` logic error 2026-06-05 17:21:09 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagentsjs#43