Workflow prompt marks valid plugin output variables invalid after refresh because command update reaches only first variable block
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- frontend
Research direction
Start in web/app/components/base/prompt-editor/plugins/workflow-variable-block/component.tsx and inspect the UPDATE_WORKFLOW_NODES_MAP command handler. Add a regression test with multiple workflow variable block listeners and verify that every block receives the updated node map and available-variable metadata after refresh, leaving valid plugin output references without warnings.
Written by the indexing model from the issue text.
Description
Self Checks
- I have read the Contributing Guide and Language Policy.
- This is only for bug report, if you would like to ask a question, please head to Discussions.
- I have searched for existing issues, including closed ones.
- I confirm that I am using English to submit this report, otherwise it will be closed.
- Please do not modify this template and fill in all the required fields.
Dify version
1.14.2. Source inspection confirms the same code is present in 1.14.0, 1.15.0, and current main.
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
- Install a custom tool plugin whose
output_schemadefines multiple output variables, for examplefile_name,markdown, andprocessing_status. - Add the tool to a workflow or an iteration.
- Add a downstream LLM node and insert all three tool output variables into its prompt.
- Save the workflow and refresh the browser page.
- Wait for the plugin metadata and workflow variables to finish loading.
After refresh, only the first variable block is shown as valid. The second and subsequent blocks display the orange "Invalid variable" warning even though:
- all selectors use the correct tool node ID and output variable names;
- all variables are present in the plugin output schema;
- the workflow checklist may report no error;
- interacting with the page or forcing another render can make the warnings disappear.
The issue is especially visible with plugin tool outputs because their variable metadata is populated asynchronously after the prompt's Lexical variable blocks have mounted.
Root cause
Each WorkflowVariableBlockComponent registers a listener for the same UPDATE_WORKFLOW_NODES_MAP Lexical command:
editor.registerCommand(
UPDATE_WORKFLOW_NODES_MAP,
(payload: UpdateWorkflowNodesMapPayload) => {
setLocalWorkflowNodesMap(payload.workflowNodesMap)
setLocalAvailableVariables(payload.availableVariables)
return true
},
COMMAND_PRIORITY_EDITOR,
)
Returning true marks the command as handled and stops propagation to the remaining listeners. As a result, the asynchronous availableVariables update reaches only the first variable block in the prompt. Later blocks keep their initial empty or stale localAvailableVariables and incorrectly render the invalid-variable state.
Changing the listener return value to false allows every variable block to receive the broadcast:
return false
The behavior became observable after PR #34715 introduced availableVariables-based validation in WorkflowVariableBlockComponent. The handler returned true before that PR as well, but validation previously relied mainly on node existence, so the stopped broadcast did not produce this multi-variable false warning.
Relevant file:
web/app/components/base/prompt-editor/plugins/workflow-variable-block/component.tsx
Related but not duplicate:
- #34714 / #34715 align prompt editor validation with checklist validation, but do not cover command propagation across multiple variable blocks.
- #30608 concerns streaming tool outputs not being selectable downstream.
- #38604 concerns unresolved Human Intervention variables during execution.
Expected Behavior
All workflow variable blocks in the prompt should receive the latest workflow node map and available-variable metadata. After refreshing the page, every valid tool output reference should remain valid and no false warning should be displayed.
Actual Behavior
Only the first workflow variable block receives the update after refresh. Subsequent valid variable references are displayed as invalid until another interaction or render updates the editor state.
Suggested regression test
Register multiple workflow variable block listeners, dispatch UPDATE_WORKFLOW_NODES_MAP, and assert that every listener receives the payload. At minimum, assert that the component command handler returns false, because this command is a broadcast rather than a single-consumer command.
- Dominant language
- TypeScript
- Stars
- 157k
- Forks
- 24.7k
- Avg merge
- 22h 32m
- Merged PRs (30d)
- 611
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from langgenius/dify
-
Annotation Reply: a stored score threshold of 0.0 is silently replaced with 1, disabling the feature Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
langgenius/dify#42639 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
langgenius/dify#42468 · 1 comment · 1 reaction ·
-
🐞 bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
langgenius/dify#42446 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
langgenius/dify#42355 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
langgenius/dify#42350 · 1 comment · 1 reaction ·
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100