[PR #677] [MERGED] fix: Redundant insertion of system/user prompts in the function-calling agent #1491

Closed
opened 2026-02-16 10:23:05 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-official-plugins/pull/677
Author: @ExenVitor
Created: 4/8/2025
Status: Merged
Merged: 4/14/2025
Merged by: @crazywoola

Base: mainHead: fix-agent-repeatedly-init-historical-msgs


📝 Commits (2)

  • 136a4e5 fix: redundant insertion of system/user prompts into message history per agent iteration.
  • 19b49f3 bump version

📊 Changes

2 files changed (+3 additions, -3 deletions)

View changed files

📝 agent-strategies/cot_agent/manifest.yaml (+1 -1)
📝 agent-strategies/cot_agent/strategies/function_calling.py (+2 -2)

📄 Description

Related Issue or Context

The function-calling agent redundantly inserts system and user prompts into message history every iteration.

Type of Change

  • Bug Fix (non-breaking change which fixes an Issue)
  • New Feature (non-breaking change which adds Functionality)
  • Breaking Change (fix or feature that may cause existing Functionality to not work as expected)
  • Documentation Update
  • Code Refactoring
  • Other

Version Control (if applicable)

  • Version bumped in Manifest.yaml (top-level Version field, not in Meta section)

Test Evidence (if applicable)

Before: System/User prompts have been inserted into prompt_messages several times when iteration_step > 1

微信截图_20250411163153

After: System/User prompts have been inserted into prompt_messages only once when iteration_step > 1

微信截图_20250411163426

Environment Verification

Important

At least one environment must be tested.

Local Deployment Environment

Local Deployment Dify Version: 1.1.3

  • Changes tested in a Clean Environment that matches Production Configuration

SaaS Environment

  • Testing performed on cloud.dify.ai
  • Changes tested in a Clean Environment that matches Production Configuration

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-official-plugins/pull/677 **Author:** [@ExenVitor](https://github.com/ExenVitor) **Created:** 4/8/2025 **Status:** ✅ Merged **Merged:** 4/14/2025 **Merged by:** [@crazywoola](https://github.com/crazywoola) **Base:** `main` ← **Head:** `fix-agent-repeatedly-init-historical-msgs` --- ### 📝 Commits (2) - [`136a4e5`](https://github.com/langgenius/dify-official-plugins/commit/136a4e5e07a6215171e018f6370318db1eb3af03) fix: redundant insertion of system/user prompts into message history per agent iteration. - [`19b49f3`](https://github.com/langgenius/dify-official-plugins/commit/19b49f3d42f961250acc80cbd949d13fed539435) bump version ### 📊 Changes **2 files changed** (+3 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `agent-strategies/cot_agent/manifest.yaml` (+1 -1) 📝 `agent-strategies/cot_agent/strategies/function_calling.py` (+2 -2) </details> ### 📄 Description ## Related Issue or Context The function-calling agent redundantly inserts system and user prompts into message history every iteration. ## Type of Change <!-- Put an `x` in all the boxes that apply --> - [x] Bug Fix (non-breaking change which fixes an Issue) - [ ] New Feature (non-breaking change which adds Functionality) - [ ] Breaking Change (fix or feature that may cause existing Functionality to not work as expected) - [ ] Documentation Update - [ ] Code Refactoring - [ ] Other ## Version Control (if applicable) - [x] Version bumped in Manifest.yaml (top-level `Version` field, not in Meta section) <!-- Version format: MAJOR.MINOR.PATCH - MAJOR (0.x.x): Reserved for Major Releases with widespread Breaking Changes - MINOR (x.0.x): For New Features or limited Breaking Changes - PATCH (x.x.0): For backwards-compatible Bug Fixes and minor Improvements - Note: Each version component (MAJOR, MINOR, PATCH) can be 2 digits, e.g., 10.11.22 --> ## Test Evidence (if applicable) #### Before: System/User prompts have been inserted into `prompt_messages` several times when `iteration_step` > 1 ![微信截图_20250411163153](https://github.com/user-attachments/assets/b0165b7b-2842-4858-beb1-29e2a185c70b) #### After: System/User prompts have been inserted into `prompt_messages` only once when `iteration_step` > 1 ![微信截图_20250411163426](https://github.com/user-attachments/assets/d8e34e36-4ef3-4cac-8f80-a1bf280de9f1) ### Environment Verification > [!IMPORTANT] > At least one environment must be tested. #### Local Deployment Environment Local Deployment Dify Version: 1.1.3 - [x] Changes tested in a Clean Environment that matches Production Configuration <!-- - Python virtual env matching Manifest.yaml & requirements.txt - No breaking changes in Dify that may affect the testing result --> #### SaaS Environment - [ ] Testing performed on cloud.dify.ai - [ ] Changes tested in a Clean Environment that matches Production Configuration <!-- - Python virtual env matching Manifest.yaml & requirements.txt --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 10:23:05 -05:00
yindo closed this issue 2026-02-16 10:23:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#1491