[PR #30682] fix(workflow): resolve race conditions in parallel streaming order #32926

Closed
opened 2026-02-21 20:52:20 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/30682

State: closed
Merged: No


Fixes #30679

Summary

This PR addresses critical race conditions and event sequencing issues in the ResponseStreamCoordinator when workflows are executed in parallel (GRAPH_ENGINE_MIN_WORKERS >= 2 and GRAPH_ENGINE_SCALE_UP_THRESHOLD=1) .

Previously, node_started and node_finished events bypassed the coordination logic, leading to "finished" events arriving at the client before the stream chunks. Furthermore, race conditions between the stream buffer and the VariablePool fallback occasionally caused template segments to output in the wrong order.

What's changed:

  • Unified Event Routing: Routed all node lifecycle events (NodeRunStartedEvent and NodeRunSucceededEvent) through the ResponseStreamCoordinator.
  • Guaranteed Event Sequence: Implemented buffering for Succeeded events to ensure they are strictly emitted only after all corresponding stream chunks have been flushed.
  • Removed Unsafe Fallback: Eliminated the variable_pool fallback logic in streaming sessions. By forcing the coordinator to rely solely on the stream buffer (and explicit stream closure via success events), we prevent premature segment completion and fix content sequencing issues.
  • Strict Ordering: Ensured a deterministic Start -> Chunks -> End event sequence for all nodes in the client-side stream.

Testing Status:

I've only tested these changes in specific parallel execution scenarios where the interleaving and out-of-order issues were previously reproducible.

Screenshots

Before (Out of Order) After (Correct Sequence)
[Finished event appears before chunks] [Chunks followed by Finished event]
[Content order: Answer -> Think] [Content order: Think -> Answer]

POST Timeline

Click to expand
data: {"event":"workflow_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"19e60cbc-f145-4f31-b95e-38069513b2fd","workflow_id":"b0b3e1a5-4a7a-449b-9fd9-982df77d7eed","inputs":{"sys.files":[],"sys.user_id":"abc-123","sys.app_id":"6b1ef9a8-071a-4635-88b5-847e676e3c08","sys.workflow_id":"b0b3e1a5-4a7a-449b-9fd9-982df77d7eed","sys.workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","sys.query":"Go","sys.dialogue_count":1},"created_at":1767770817}}

data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"735937a4-a720-41a3-8530-705f49775a97","node_id":"1767663059744","node_type":"start","title":"User Input","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770816,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}}

data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"735937a4-a720-41a3-8530-705f49775a97","node_id":"1767663059744","node_type":"start","title":"User Input","index":1,"predecessor_node_id":null,"inputs":{"sys.files":[],"sys.user_id":"abc-123","sys.app_id":"6b1ef9a8-071a-4635-88b5-847e676e3c08","sys.workflow_id":"b0b3e1a5-4a7a-449b-9fd9-982df77d7eed","sys.workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","sys.query":"Go","sys.conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","sys.dialogue_count":1},"inputs_truncated":false,"process_data":{},"process_data_truncated":false,"outputs":{"sys.files":[],"sys.user_id":"abc-123","sys.app_id":"6b1ef9a8-071a-4635-88b5-847e676e3c08","sys.workflow_id":"b0b3e1a5-4a7a-449b-9fd9-982df77d7eed","sys.workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","sys.query":"Go","sys.conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","sys.dialogue_count":1},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":0.788085,"execution_metadata":null,"created_at":1767770816,"finished_at":1767770817,"files":[],"iteration_id":null,"loop_id":null}}

data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"278bc52e-4e28-4bd2-ae83-e8f76be27045","node_id":"1767663118401","node_type":"code","title":"Code","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770816,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}}

data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"278bc52e-4e28-4bd2-ae83-e8f76be27045","node_id":"1767663118401","node_type":"code","title":"Code","index":1,"predecessor_node_id":null,"inputs":{},"inputs_truncated":false,"process_data":{},"process_data_truncated":false,"outputs":{},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":1.740601,"execution_metadata":null,"created_at":1767770816,"finished_at":1767770818,"files":[],"iteration_id":null,"loop_id":null}}

data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"cd510232-cd3b-423c-9bbc-f151f2a73307","node_id":"17676632864980","node_type":"llm","title":"下一步计划","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770818,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}}

data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"bf851b23-ca89-4bca-8201-6eac633f8402","node_id":"17676631639570","node_type":"code","title":"Code (1)","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770818,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}}

data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"bf851b23-ca89-4bca-8201-6eac633f8402","node_id":"17676631639570","node_type":"code","title":"Code (1)","index":1,"predecessor_node_id":null,"inputs":{},"inputs_truncated":false,"process_data":{},"process_data_truncated":false,"outputs":{},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":0.532564,"execution_metadata":null,"created_at":1767770818,"finished_at":1767770818,"files":[],"iteration_id":null,"loop_id":null}}

data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"736f7267-e214-4d08-963d-d94c0f67a02f","node_id":"llm","node_type":"llm","title":"思考","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770818,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"think","from_variable_selector":["llm","text"]}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":" content","from_variable_selector":["llm","text"]}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["llm","text"]}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["llm","text"]}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["llm","text"]}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["llm","text"]}

data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"736f7267-e214-4d08-963d-d94c0f67a02f","node_id":"llm","node_type":"llm","title":"思考","index":1,"predecessor_node_id":null,"inputs":{},"inputs_truncated":false,"process_data":{"model_mode":"chat","prompts":[{"role":"system","text":"你是一个复读机,无论提问是什么,你都只能回答“think content”","files":[]},{"role":"user","text":"Go","files":[]}],"usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.751,"time_to_first_token":0.738,"time_to_generate":0.014},"finish_reason":"stop","model_provider":"langgenius/volcengine_maas/volcengine_maas","model_name":"deepseek-V3"},"process_data_truncated":false,"outputs":{"text":"think content","reasoning_content":"","usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.751,"time_to_first_token":0.738,"time_to_generate":0.014},"finish_reason":"stop"},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":1.743514,"execution_metadata":{"total_tokens":23,"total_price":"0.000058","currency":"RMB"},"created_at":1767770818,"finished_at":1767770820,"files":[],"iteration_id":null,"loop_id":null}}

data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"cd510232-cd3b-423c-9bbc-f151f2a73307","node_id":"17676632864980","node_type":"llm","title":"下一步计划","index":1,"predecessor_node_id":null,"inputs":{},"inputs_truncated":false,"process_data":{"model_mode":"chat","prompts":[{"role":"system","text":"你是一个复读机,无论提问是什么,你都只能回答“next plan“","files":[]},{"role":"user","text":"Go","files":[]}],"usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.759,"time_to_first_token":0.736,"time_to_generate":0.022},"finish_reason":"stop","model_provider":"langgenius/volcengine_maas/volcengine_maas","model_name":"deepseek-V3"},"process_data_truncated":false,"outputs":{"text":"next plan","reasoning_content":"","usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.759,"time_to_first_token":0.736,"time_to_generate":0.022},"finish_reason":"stop"},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":1.767723,"execution_metadata":{"total_tokens":23,"total_price":"0.000058","currency":"RMB"},"created_at":1767770818,"finished_at":1767770820,"files":[],"iteration_id":null,"loop_id":null}}

data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"178b4a04-81bd-4f96-bd7a-9dc03017847b","node_id":"17676646910030","node_type":"code","title":"Code (2)","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770820,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}}

data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"178b4a04-81bd-4f96-bd7a-9dc03017847b","node_id":"17676646910030","node_type":"code","title":"Code (2)","index":1,"predecessor_node_id":null,"inputs":{"text":"think content"},"inputs_truncated":false,"process_data":{},"process_data_truncated":false,"outputs":{"think":"think content"},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":0.2141,"execution_metadata":null,"created_at":1767770820,"finished_at":1767770820,"files":[],"iteration_id":null,"loop_id":null}}

data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"a21a781a-237e-43f0-aa1d-a4ffbd110598","node_id":"17676632797600","node_type":"llm","title":"回答","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770820,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"Mock","from_variable_selector":["17676632797600","text"]}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":" answer","from_variable_selector":["17676632797600","text"]}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["17676632797600","text"]}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["17676632797600","text"]}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["17676632797600","text"]}

data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["17676632797600","text"]}

data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"a21a781a-237e-43f0-aa1d-a4ffbd110598","node_id":"17676632797600","node_type":"llm","title":"回答","index":1,"predecessor_node_id":null,"inputs":{},"inputs_truncated":false,"process_data":{"model_mode":"chat","prompts":[{"role":"system","text":"你是一个复读机,无论提问是什么,你都只能回答“Mock answer”","files":[]},{"role":"user","text":"Go","files":[]}],"usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.613,"time_to_first_token":0.608,"time_to_generate":0.006},"finish_reason":"stop","model_provider":"langgenius/volcengine_maas/volcengine_maas","model_name":"deepseek-V3"},"process_data_truncated":false,"outputs":{"text":"Mock answer","reasoning_content":"","usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.613,"time_to_first_token":0.608,"time_to_generate":0.006},"finish_reason":"stop"},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":0.686561,"execution_metadata":{"total_tokens":23,"total_price":"0.000058","currency":"RMB"},"created_at":1767770820,"finished_at":1767770821,"files":[],"iteration_id":null,"loop_id":null}}

data: {"event":"workflow_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"19e60cbc-f145-4f31-b95e-38069513b2fd","workflow_id":"b0b3e1a5-4a7a-449b-9fd9-982df77d7eed","status":"succeeded","outputs":{"answer":"think contentMock answer","files":[]},"error":null,"elapsed_time":3.959199,"total_tokens":69,"total_steps":9,"created_by":{"id":"17e99005-7eaf-4c6e-8b77-76dddec5e2e6","user":"abc-123"},"created_at":1767770817,"finished_at":1767770821,"exceptions_count":0,"files":[]}}

data: {"event":"message_end","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","metadata":{"annotation_reply":null,"retriever_resources":[],"usage":{"prompt_tokens":63,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000126","completion_tokens":6,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000048","total_tokens":69,"total_price":"0.000174","currency":"RMB","latency":2.123,"time_to_first_token":4.005,"time_to_generate":0.969}},"files":[]}


Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues.
  • I've added a test for each change that was introduced. (Self-tested in problem scenarios only)
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/30682 **State:** closed **Merged:** No --- Fixes #30679 ## Summary This PR addresses critical race conditions and event sequencing issues in the `ResponseStreamCoordinator` when workflows are executed in parallel (`GRAPH_ENGINE_MIN_WORKERS >= 2` and `GRAPH_ENGINE_SCALE_UP_THRESHOLD=1`) . Previously, `node_started` and `node_finished` events bypassed the coordination logic, leading to "finished" events arriving at the client before the stream chunks. Furthermore, race conditions between the stream buffer and the `VariablePool` fallback occasionally caused template segments to output in the wrong order. ### What's changed: - **Unified Event Routing**: Routed all node lifecycle events (`NodeRunStartedEvent` and `NodeRunSucceededEvent`) through the `ResponseStreamCoordinator`. - **Guaranteed Event Sequence**: Implemented buffering for `Succeeded` events to ensure they are strictly emitted only after all corresponding stream chunks have been flushed. - **Removed Unsafe Fallback**: Eliminated the `variable_pool` fallback logic in streaming sessions. By forcing the coordinator to rely solely on the stream buffer (and explicit stream closure via success events), we prevent premature segment completion and fix content sequencing issues. - **Strict Ordering**: Ensured a deterministic `Start` -> `Chunks` -> `End` event sequence for all nodes in the client-side stream. ### Testing Status: I've **only** tested these changes in specific parallel execution scenarios where the interleaving and out-of-order issues were previously reproducible. ## Screenshots | Before (Out of Order) | After (Correct Sequence) | |--------|-------| | [Finished event appears before chunks] | [Chunks followed by Finished event] | | [Content order: Answer -> Think] | [Content order: Think -> Answer] | ### POST Timeline <details> <summary>Click to expand </summary> ```post time line data: {"event":"workflow_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"19e60cbc-f145-4f31-b95e-38069513b2fd","workflow_id":"b0b3e1a5-4a7a-449b-9fd9-982df77d7eed","inputs":{"sys.files":[],"sys.user_id":"abc-123","sys.app_id":"6b1ef9a8-071a-4635-88b5-847e676e3c08","sys.workflow_id":"b0b3e1a5-4a7a-449b-9fd9-982df77d7eed","sys.workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","sys.query":"Go","sys.dialogue_count":1},"created_at":1767770817}} data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"735937a4-a720-41a3-8530-705f49775a97","node_id":"1767663059744","node_type":"start","title":"User Input","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770816,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}} data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"735937a4-a720-41a3-8530-705f49775a97","node_id":"1767663059744","node_type":"start","title":"User Input","index":1,"predecessor_node_id":null,"inputs":{"sys.files":[],"sys.user_id":"abc-123","sys.app_id":"6b1ef9a8-071a-4635-88b5-847e676e3c08","sys.workflow_id":"b0b3e1a5-4a7a-449b-9fd9-982df77d7eed","sys.workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","sys.query":"Go","sys.conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","sys.dialogue_count":1},"inputs_truncated":false,"process_data":{},"process_data_truncated":false,"outputs":{"sys.files":[],"sys.user_id":"abc-123","sys.app_id":"6b1ef9a8-071a-4635-88b5-847e676e3c08","sys.workflow_id":"b0b3e1a5-4a7a-449b-9fd9-982df77d7eed","sys.workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","sys.query":"Go","sys.conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","sys.dialogue_count":1},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":0.788085,"execution_metadata":null,"created_at":1767770816,"finished_at":1767770817,"files":[],"iteration_id":null,"loop_id":null}} data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"278bc52e-4e28-4bd2-ae83-e8f76be27045","node_id":"1767663118401","node_type":"code","title":"Code","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770816,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}} data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"278bc52e-4e28-4bd2-ae83-e8f76be27045","node_id":"1767663118401","node_type":"code","title":"Code","index":1,"predecessor_node_id":null,"inputs":{},"inputs_truncated":false,"process_data":{},"process_data_truncated":false,"outputs":{},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":1.740601,"execution_metadata":null,"created_at":1767770816,"finished_at":1767770818,"files":[],"iteration_id":null,"loop_id":null}} data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"cd510232-cd3b-423c-9bbc-f151f2a73307","node_id":"17676632864980","node_type":"llm","title":"下一步计划","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770818,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}} data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"bf851b23-ca89-4bca-8201-6eac633f8402","node_id":"17676631639570","node_type":"code","title":"Code (1)","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770818,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}} data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"bf851b23-ca89-4bca-8201-6eac633f8402","node_id":"17676631639570","node_type":"code","title":"Code (1)","index":1,"predecessor_node_id":null,"inputs":{},"inputs_truncated":false,"process_data":{},"process_data_truncated":false,"outputs":{},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":0.532564,"execution_metadata":null,"created_at":1767770818,"finished_at":1767770818,"files":[],"iteration_id":null,"loop_id":null}} data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"736f7267-e214-4d08-963d-d94c0f67a02f","node_id":"llm","node_type":"llm","title":"思考","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770818,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"think","from_variable_selector":["llm","text"]} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":" content","from_variable_selector":["llm","text"]} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["llm","text"]} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["llm","text"]} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["llm","text"]} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["llm","text"]} data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"736f7267-e214-4d08-963d-d94c0f67a02f","node_id":"llm","node_type":"llm","title":"思考","index":1,"predecessor_node_id":null,"inputs":{},"inputs_truncated":false,"process_data":{"model_mode":"chat","prompts":[{"role":"system","text":"你是一个复读机,无论提问是什么,你都只能回答“think content”","files":[]},{"role":"user","text":"Go","files":[]}],"usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.751,"time_to_first_token":0.738,"time_to_generate":0.014},"finish_reason":"stop","model_provider":"langgenius/volcengine_maas/volcengine_maas","model_name":"deepseek-V3"},"process_data_truncated":false,"outputs":{"text":"think content","reasoning_content":"","usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.751,"time_to_first_token":0.738,"time_to_generate":0.014},"finish_reason":"stop"},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":1.743514,"execution_metadata":{"total_tokens":23,"total_price":"0.000058","currency":"RMB"},"created_at":1767770818,"finished_at":1767770820,"files":[],"iteration_id":null,"loop_id":null}} data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"cd510232-cd3b-423c-9bbc-f151f2a73307","node_id":"17676632864980","node_type":"llm","title":"下一步计划","index":1,"predecessor_node_id":null,"inputs":{},"inputs_truncated":false,"process_data":{"model_mode":"chat","prompts":[{"role":"system","text":"你是一个复读机,无论提问是什么,你都只能回答“next plan“","files":[]},{"role":"user","text":"Go","files":[]}],"usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.759,"time_to_first_token":0.736,"time_to_generate":0.022},"finish_reason":"stop","model_provider":"langgenius/volcengine_maas/volcengine_maas","model_name":"deepseek-V3"},"process_data_truncated":false,"outputs":{"text":"next plan","reasoning_content":"","usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.759,"time_to_first_token":0.736,"time_to_generate":0.022},"finish_reason":"stop"},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":1.767723,"execution_metadata":{"total_tokens":23,"total_price":"0.000058","currency":"RMB"},"created_at":1767770818,"finished_at":1767770820,"files":[],"iteration_id":null,"loop_id":null}} data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"178b4a04-81bd-4f96-bd7a-9dc03017847b","node_id":"17676646910030","node_type":"code","title":"Code (2)","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770820,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}} data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"178b4a04-81bd-4f96-bd7a-9dc03017847b","node_id":"17676646910030","node_type":"code","title":"Code (2)","index":1,"predecessor_node_id":null,"inputs":{"text":"think content"},"inputs_truncated":false,"process_data":{},"process_data_truncated":false,"outputs":{"think":"think content"},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":0.2141,"execution_metadata":null,"created_at":1767770820,"finished_at":1767770820,"files":[],"iteration_id":null,"loop_id":null}} data: {"event":"node_started","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"a21a781a-237e-43f0-aa1d-a4ffbd110598","node_id":"17676632797600","node_type":"llm","title":"回答","index":1,"predecessor_node_id":null,"inputs":null,"inputs_truncated":false,"created_at":1767770820,"extras":{},"iteration_id":null,"loop_id":null,"agent_strategy":null}} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"Mock","from_variable_selector":["17676632797600","text"]} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":" answer","from_variable_selector":["17676632797600","text"]} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["17676632797600","text"]} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["17676632797600","text"]} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["17676632797600","text"]} data: {"event":"message","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","answer":"","from_variable_selector":["17676632797600","text"]} data: {"event":"node_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"a21a781a-237e-43f0-aa1d-a4ffbd110598","node_id":"17676632797600","node_type":"llm","title":"回答","index":1,"predecessor_node_id":null,"inputs":{},"inputs_truncated":false,"process_data":{"model_mode":"chat","prompts":[{"role":"system","text":"你是一个复读机,无论提问是什么,你都只能回答“Mock answer”","files":[]},{"role":"user","text":"Go","files":[]}],"usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.613,"time_to_first_token":0.608,"time_to_generate":0.006},"finish_reason":"stop","model_provider":"langgenius/volcengine_maas/volcengine_maas","model_name":"deepseek-V3"},"process_data_truncated":false,"outputs":{"text":"Mock answer","reasoning_content":"","usage":{"prompt_tokens":21,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000042","completion_tokens":2,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000016","total_tokens":23,"total_price":"0.000058","currency":"RMB","latency":0.613,"time_to_first_token":0.608,"time_to_generate":0.006},"finish_reason":"stop"},"outputs_truncated":false,"status":"succeeded","error":null,"elapsed_time":0.686561,"execution_metadata":{"total_tokens":23,"total_price":"0.000058","currency":"RMB"},"created_at":1767770820,"finished_at":1767770821,"files":[],"iteration_id":null,"loop_id":null}} data: {"event":"workflow_finished","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","workflow_run_id":"19e60cbc-f145-4f31-b95e-38069513b2fd","data":{"id":"19e60cbc-f145-4f31-b95e-38069513b2fd","workflow_id":"b0b3e1a5-4a7a-449b-9fd9-982df77d7eed","status":"succeeded","outputs":{"answer":"think contentMock answer","files":[]},"error":null,"elapsed_time":3.959199,"total_tokens":69,"total_steps":9,"created_by":{"id":"17e99005-7eaf-4c6e-8b77-76dddec5e2e6","user":"abc-123"},"created_at":1767770817,"finished_at":1767770821,"exceptions_count":0,"files":[]}} data: {"event":"message_end","conversation_id":"c6fe183e-a849-4710-a954-4ed5db84a445","message_id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","created_at":1767770815,"task_id":"ccbdc189-81ba-45fc-a395-621a09af0049","id":"6404f60e-153f-4ea4-bf6e-ae262b12c23a","metadata":{"annotation_reply":null,"retriever_resources":[],"usage":{"prompt_tokens":63,"prompt_unit_price":"0.002","prompt_price_unit":"0.001","prompt_price":"0.000126","completion_tokens":6,"completion_unit_price":"0.008","completion_price_unit":"0.001","completion_price":"0.000048","total_tokens":69,"total_price":"0.000174","currency":"RMB","latency":2.123,"time_to_first_token":4.005,"time_to_generate":0.969}},"files":[]} ``` ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. - [ ] I've added a test for each change that was introduced. (Self-tested in problem scenarios only) - [ ] I've updated the documentation accordingly. - [x] I ran `make lint` and `make type-check` (backend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:52:20 -05:00
yindo closed this issue 2026-02-21 20:52:20 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#32926