Back Home

GitHub Repo

Dify Community Reports Resent Reasoning History Anomaly; Agent App May Mimic Tags and Fabricate Tool Calls

A report from the Dify community on October 28 says Agent App resends historical reasoning as text tags, potentially disrupting multi-turn tool use. Public code confirms this serialization behavior, but the alleged link to tool-call hallucinations still needs independent reproduction.

The original uploader was Ggia at Greek Wikipedia. · CC BY-SA 2.5 · Image source
zh-Hant

A compatibility report about Dify’s agent execution flow warrants attention from deployment teams. On October 28, a user reported that the newer Agent App, running on a self-hosted 1.18.0 deployment via dify-agent and paired with the Tongyi plugin and qwen3.8-max, puts reasoning from the previous turn back into a regular assistant message. The report says the model then outputs extra tags and may even cite job IDs that were never returned by a tool. These observations are currently limited to a single deployment. Community issue

The directly verifiable technical issue lies in the history-message conversion layer: when _map_model_response_to_prompt_message() encounters a ThinkingPart, it wraps the content in <think>…</think> and adds it to the text content; an actual ToolCallPart is converted separately into a structured tool call. As a result, a reasoning block that originally had distinct semantics becomes ordinary text visible to the model in the next turn. Dify code

This distinction has a clear interface rationale. Alibaba Cloud’s official documentation says historical reasoning for qwen3.8-max should be passed back through the reasoning_content field, and explicitly warns that concatenating reasoning into content may degrade model performance. preserve_thinking controls whether historical reasoning is included; enabling it also increases input-token charges. The framework and plugin therefore need to preserve field semantics together; retaining only the text visible on screen is not enough to ensure consistent multi-turn agent behavior. Official API documentation

As of this review, the issue remains open, with no confirmed official fix. A contributor also confirmed the code behavior that resends tags and produces a stray closing tag, but said they had not independently reproduced the production tool hallucination. Engineering teams should next focus on history-message round-trip tests, tag splitting in streaming responses, and whether tool calls remain correctly paired with their returned IDs. When evaluating a fix, they should measure task success rates and token costs separately, rather than treating the disappearance of tags as proof that agent reliability has been restored. Investigation and fix planning

Sources

  1. Dify Issue #44964:Agent App replays reasoning as literal think tags
  2. Dify 代理模型介接與歷史訊息轉換程式碼
  3. Alibaba Cloud Model Studio:OpenAI compatible Chat API