dify icon indicating copy to clipboard operation
dify copied to clipboard

Human Intervention node displays unresolved variable references after page refresh during execution

Open severnxue-dify opened this issue 4 months ago • 1 comments

Self Checks

  • [x] I have read the Contributing Guide and Language Policy.
  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report, otherwise it will be closed.
  • [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • [x] Please do not modify this template :) and fill in all the required fields.

Dify version

1.15.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Create a chatflow/app that uses a Human Intervention node.
  2. Configure the Human Intervention node's form content to reference an upstream text variable.
  3. Run the app and reach the pending human intervention card.
  4. Refresh the app page while the workflow is still waiting for human action.
  5. Check the form content shown in the human intervention card.
  6. Select one of the available actions.

Possibly related to #37588, but this report is specifically about the page refresh case: after refresh, the card initially renders the raw variable reference and only resolves it after an action is selected.

Image Image

✔️ Expected Behavior

After refreshing the page during execution, the form content only shows the raw variable reference, for example {{#1778488854176.text#}}.

The actual text value is not visible until one of the actions is selected.

From the attached screenshots:

  • Before selecting an action, the form content displays the variable reference.
  • After selecting an action, the concrete text value is displayed.

❌ Actual Behavior

After refreshing the page during execution, the form content only shows the raw variable reference, for example {{#1778488854176.text#}}.

The actual text value is not visible until one of the actions is selected.

From the attached screenshots:

  • Before selecting an action, the form content displays the variable reference.
  • After selecting an action, the concrete text value is displayed.

severnxue-dify avatar Jul 09 '26 09:07 severnxue-dify

Hi @severnxue-dify! I'm Dosu and I'm helping the Dify team.

Thanks for the detailed report. Based on my investigation, here's what's happening:

How it's supposed to work: When a workflow pauses at a Human Input node, the backend calls DifyHITLCallback.render_form_content_before_submission(), which uses VariablePool.convert_template() to resolve all upstream variable references (like {{#1778488854176.text#}}) into their concrete values [1]. The resolved content is stored as rendered_content in the database, and the API endpoint (GET /form/human_input/<token>) should return this pre-rendered content [2]. The frontend does not resolve these variables client-side — it expects the API to deliver already-resolved content [3].

Likely root cause: After page refresh, the form content API appears to be returning the raw template (with unresolved {{#nodeId.variable#}} references) instead of the rendered_content. The frontend's form content parser only recognizes {{#$output.field_name#}} patterns for input field placeholders [4], so upstream variable references like {{#1778488854176.text#}} pass through as raw text.

The fact that variables resolve correctly after selecting an action suggests that the post-action flow triggers a re-render or fetches from a different (correct) source.

Possible places to investigate:

  1. Whether render_form_content_before_submission() is being called successfully during the initial pause — the VariablePool may not have the upstream node outputs available at that point
  2. Whether the API response mapping in HumanInputFormDefinitionResponse.from_form() is correctly returning rendered_content vs. the raw form_content template [5]
  3. Whether the rendered_content field in the database actually contains resolved content for these forms

This appears to be a backend rendering/storage issue rather than a frontend parsing problem. The behavior you see (resolves after action) likely means the post-submission rendering path works correctly but the pre-submission rendered content is either not being stored or not being served from the correct field.

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about dify

dosubot[bot] avatar Jul 09 '26 09:07 dosubot[bot]