Skip to content

fix: bound agentflow token counting fallback#6562

Open
vicksiyi wants to merge 2 commits into
FlowiseAI:mainfrom
vicksiyi:codex/condition-agent-token-timeout
Open

fix: bound agentflow token counting fallback#6562
vicksiyi wants to merge 2 commits into
FlowiseAI:mainfrom
vicksiyi:codex/condition-agent-token-timeout

Conversation

@vicksiyi

Copy link
Copy Markdown

Summary

  • Added a bounded token counter with approximate fallback and reused it in agentflow summary-buffer memory paths.

Tests

  • git diff --check passed
  • ./node_modules/.bin/jest nodes/agentflow/utils.test.ts --runInBand --verbose passed
  • ./node_modules/.bin/tsc --noEmit --pretty false passed from packages/components
  • prettier check passed
  • eslint blocked locally by Node v26 ERR_INVALID_PACKAGE_CONFIG

Notes

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces a robust token counting utility (createTokenCounter) with timeout handling and fallback mechanisms, integrating it across several agent flow nodes to manage memory limits safely. The feedback suggests addressing a potential timeout leak in getNumTokensWithTimeout if a synchronous error is thrown, and adding defensive checks in createTokenCounter to handle nullish or invalid llm objects.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/components/nodes/agentflow/utils.ts
Comment thread packages/components/nodes/agentflow/utils.ts Outdated
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