difyctl reports a successfully finished workflow as suspended after human input
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
main at 5e38d73d8f44b3c899c0ee64dd8d038813a2194a
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
The get.run.event operation supports keeping its event stream open across a human-input pause. In the default CLI output mode, the run's final summary depends on whether the stream included the pause.
To reproduce locally from cli/, run the following with Bun. It calls the same functions that the CLI uses to summarize the SSE response.
bun -e '
import { newFoldResult, foldEvent, finishFold } from "./src/call/fold.ts"
const run = newFoldResult()
foldEvent(run, "human_input_required", {
workflow_run_id: "r1",
hints: [{ op: "submit.run.form", summary: "Approve", form: [] }]
})
foldEvent(run, "workflow_finished", {
workflow_run_id: "r1",
data: { status: "succeeded", outputs: { approved: true } }
})
console.log(JSON.stringify(finishFold(run)))
'
✔️ Expected Behavior
Once the same run emits workflow_finished with status: "succeeded", the CLI reports ended with the final outputs. The completed form is no longer offered as a next step. A stream that ends while waiting for human input should still report suspended with the form hint.
❌ Actual Behavior
The result contains "status":"suspended", the earlier form submission hint, and "outputs":{"approved":true} together. Sending the same finish event on its own produces ended. An automation reading the summary can therefore ask for approval after the run has already completed.
The fold status order ranks suspended above ended. This reproduction exercises the CLI fold locally. The server-side option is defined in the run events endpoint.
The mismatch is in the CLI summary, not the workflow’s execution state. workflow_finished copies the final outputs even when the status update to ended is rejected. The form hint persists because the pause handler appends it and finishFold doesn’t remove it. [1] [2] [3]
For automation, add --stream to the same get.run.event call and use the matching workflow_finished event’s data.status and data.outputs instead of the folded summary. --stream prints the events as JSON lines without emitting the summary. [4] [5]
For a regression test, I’d make workflow_finished resolve the pause and retire only the form hints, rather than globally ranking ended above suspended: message_end also raises ended and can carry a separate reply hint. [6] [7] [8]
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
I'll take this one — I've reproduced it and will open a PR with a fix shortly.
@jimmyallinai Thanks, but I've already started working on a fix.