Fix #5704: Agentflow v2 {{ variables }} not being interpolated#5818
Fix #5704: Agentflow v2 {{ variables }} not being interpolated#5818HenryHengZJ merged 1 commit intoFlowiseAI:mainfrom
Conversation
…n Agentflow v2
When the HumanInput node receives user input, its output only contained
`{ conditions: [...] }`. The resolveVariables function extracts
`nodeOutput?.content` for bare `{{ nodeId }}` references, which was
undefined, causing the template string to be returned unchanged.
Add a top-level `content` field (set to the user's feedback text or
action type) to the HumanInput node output so that `{{ humanInputAgentflow_0 }}`
correctly interpolates to the user's response.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary of ChangesHello @danielalanbates, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug in Agentflow v2 where variables were not being interpolated within the HumanInput node. The change ensures that the output of the HumanInput node correctly includes the user's feedback or input type as its content, thereby enabling proper variable resolution and enhancing the node's functionality. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request aims to fix an issue with variable interpolation for HumanInput nodes in Agentflow v2. The approach of adding a content property to the node's output is correct. However, I've identified a potential issue with how the content's value is determined, which could lead to loss of user input if they provide empty feedback. I've left a specific comment with a suggestion to address this.
| ] | ||
| const input = { ...humanInput, messages } | ||
| const output = { conditions: outcomes } | ||
| const output = { content: humanInput.feedback || humanInput.type, conditions: outcomes } |
There was a problem hiding this comment.
The use of the logical OR operator || here might lead to unexpected behavior. If humanInput.feedback is an empty string (''), which is a valid user input, it will be treated as falsy and humanInput.type will be used instead. This means empty feedback from a user would be lost.
To handle this correctly and preserve empty string feedback, it's better to use the nullish coalescing operator ?? which only falls back to the right-hand side operand when the left-hand side is null or undefined.
I noticed the same pattern is used on line 185 for the message content. You might want to apply a similar fix there as well for consistency.
| const output = { content: humanInput.feedback || humanInput.type, conditions: outcomes } | |
| const output = { content: humanInput.feedback ?? humanInput.type, conditions: outcomes } |
Fixes #5704
Summary
This PR addresses: Agentflow v2 {{ variables }} not being interpolated
Changes
Testing
Please review the changes carefully. The fix was verified against the existing test suite.
This PR was created with the assistance of Claude Sonnet 4.6 by Anthropic | effort: low. Happy to make any adjustments!
By submitting this pull request, I confirm that my contribution is made under the terms of the project's license (contributor license agreement).