Skip to content

fix(agentflow): fix variable resolution, credential sync, and add E2E example#6245

Merged
jocelynlin-wd merged 3 commits into
mainfrom
fix/agentflow-variable-resolution-e2e
Apr 20, 2026
Merged

fix(agentflow): fix variable resolution, credential sync, and add E2E example#6245
jocelynlin-wd merged 3 commits into
mainfrom
fix/agentflow-variable-resolution-e2e

Conversation

@jocelynlin-wd

@jocelynlin-wd jocelynlin-wd commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

FLOWISE-558

Summary

  • Fix variable resolution for HTTP and other nodes: Three-layer bug caused upstream node variables to render as literal text in agent prompts:

    • useAvailableVariables.ts: variable picker emitted {{nodeId.data.instance}} instead of {{nodeId}}
    • customMention.ts: mention serializer used the display label (e.g. HTTP 0) instead of the node ID (e.g. httpAgentflow_0)
    • useAvailableVariables.ts: exclude Start node from upstream node outputs — users reference the question via global {{question}}, consistent with agentflow v2 (no Start.ts or server change needed)
  • Fix variable chip display consistency: Mention chips in the editor now show {{nodeId}} (e.g. {{httpAgentflow_0}}) instead of the display label (e.g. {{HTTP 0}}), matching the value serialized to flow data.

  • Fix credential sync for HTTP nodes: When a user selected a credential in the node editor, it was stored only in inputs.FLOWISE_CREDENTIAL_ID but server-side execution reads nodeData.credential. Now both are kept in sync on selection.

  • Add E2E example to examples app: New E2eExample.tsx demonstrating full Flowise integration — load flow from DB, editable title, save, delete, and test run via FABs passed as canvasActions. Simplified BasicExample to minimal canvas-only usage.

  • Test fixes: Updated test expectations for customMention, useAvailableVariables, nodeFactory, TooltipWithParser, and useAsyncOptions to match corrected behavior and suppress act() warnings.

🤖 Generated with Claude Code

example with http node and variable fix

agentflow-sdk-variable-http-node-fix.mov

e2e demo using existing flow from db

Screen.Recording.2026-04-17.at.5.57.41.PM.mov

… example

- Fix variable picker emitting {{nodeId.data.instance}} instead of {{nodeId}}
- Fix customMention serializer using display label instead of node ID
- Fix Start node missing outputData.content for chatInput type
- Sync credential selection to nodeData.credential for server-side execution
- Add E2E example with save/delete/test-run FABs via canvasActions
- Simplify BasicExample to minimal canvas-only usage
- Fix act() warnings in TooltipWithParser and useAsyncOptions tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@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 comprehensive E2E example for Agentflow, including new components for saving flows to a database, performing test runs, and managing flow metadata. It also refactors variable mention rendering to use IDs instead of labels and updates the node factory to handle credential IDs. Key feedback includes addressing a potential XSS vulnerability when rendering markdown, avoiding the overloading of the credential property to prevent UI hydration issues, and improving error handling for network requests in the E2E demo.

Comment thread packages/agentflow/examples/src/TestRunDialog.tsx
Comment thread packages/agentflow/src/core/utils/nodeFactory.ts
Comment thread packages/agentflow/examples/src/demos/E2eExample.tsx Outdated
jocelynlin-wd and others added 2 commits April 17, 2026 18:07
…2E example

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nt field

- VariableInput: show {{nodeId}} in mention chip instead of display label,
  consistent with the value serialized to flow data
- useAvailableVariables: exclude startAgentflow from upstream node outputs;
  users reference the question via {{question}} (global variable), matching
  agentflow v2 behavior — no Start node change or server change needed
- Start.ts: revert outputData.content = input; Start node is no longer
  exposed as a node output variable in the picker

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@HenryHengZJ

HenryHengZJ commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

fix looks good and tested.

few things not related to the changes

  1. Dropdown does not have shadow, and the items should not be bold
image Expected: image
  1. maybe its in another PR, but I dont see the {{output}} yet from variable selection:
image Expected: image
  1. Inconsistent type font size, font style, font weight. This apply to the whole package where we need to define different types of typography, and use these throughout the package. Having said that, in Extend it looks fine though
image

TextInput seems to be much bigger than other text
image
image
image

  1. Inconsistent spacing:
image

@jocelynlin-wd jocelynlin-wd merged commit 3542a04 into main Apr 20, 2026
7 checks passed
@jocelynlin-wd jocelynlin-wd deleted the fix/agentflow-variable-resolution-e2e branch April 20, 2026 19:20
@j-sanaa

j-sanaa commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

@HenryHengZJ

From your comment above on inconsistent type font size and font style, want to make sure that we no longer want monospace font in Source mode?

Screenshot 2026-04-23 at 4 34 23 PM Screenshot 2026-04-23 at 4 32 41 PM

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.

3 participants