feat: critic agent#3320
Conversation
I've found out that we've got no critic agent for self-evolving, so I add an agent here
There was a problem hiding this comment.
Code Review
This pull request introduces the initial skeleton and configuration files for the Self-Refine Agent Strategy plugin, establishing the directory structure, manifest, and basic provider/strategy frameworks. The code review identified two critical runtime issues in the strategy implementation: an incorrect import path for AgentInvokeMessage that will cause an ImportError, and an invalid signature for the _invoke method that includes unsupported parameters, which will result in a TypeError during execution.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
KERVIN-FARMER
left a comment
There was a problem hiding this comment.
I‘ve solved your raised concerns, and thank you for pointing them out
|
@gemini-code-assist thank you |
There was a problem hiding this comment.
Code Review
This pull request implements a new Self-Refine Agent Strategy plugin for Dify, enabling iterative self-critique and refinement loops. The review feedback identifies a critical runtime TypeError where yield from is incorrectly used on _evaluate_output, which is a regular function rather than a generator. Additionally, several type annotations for generator methods need correction to accurately reflect their yield and return types, and the parsed context parameter should be integrated into the prompt construction instead of being ignored.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Hi @KERVIN-FARMER, thanks for contributing this Self-Refine Agent Strategy plugin! I can't do a full traditional code review, but I can share observations and flag potential issues based on the PR diff and how existing agent strategy plugins are structured in this repository. Overall Impression: The concept is solid — implementing the Self-Refine (NeurIPS 2023) iterative refinement loop as a Dify agent strategy. The code structure (provider/strategy separation, prompt templates, YAML configs) follows the right patterns. Here are some things to address: Issues to Fix:
Suggestions for Improvement:
PR Checklist Items Still Missing:
The core approach is good and aligns with the existing plugin architecture. The main things to fix before this is review-ready are the placeholder values, the README contradiction, and making sure you've tested it end-to-end on a Dify instance. Good luck! |
Type error and other settings solved
|
@gemini-code-review Help me to correct all the current errors if there're still things I need to do, write me a brief prompt at the final stage if not, help me to push and merge it thank you |
Sorry for misspelling your name But I would expect you to do the same things as above thank you |
|
Hi @KERVIN-FARMER, I've reviewed your code for the 1. Security & Configuration
2. Maintainability & Code Quality
3. Missing Requirements
Code SuggestionsUpdate author: "KERVIN-FARMER"Update Improve import re
# ... inside _evaluate_output ...
# Use regex to find JSON block
match = re.search(r'\{.*\}', eval_text, re.DOTALL)
if match:
eval_data = json.loads(match.group(0))
# ... proceed with evaluation ...Final Steps
Once these items are addressed, your implementation will be much more robust and ready for final review. |
|
Hi @KERVIN-FARMER! I've reviewed the current state of your PR. The good news is that all the core implementation files are in place (12 files total, including 🔴 Errors to Fix (blocking):
🟡 Should fix (likely review feedback):
✅ What's looking good:
📋 Quick fix prompt you can use:
Regarding pushing and merging — I can't do that for you, but once you apply the fixes above and a maintainer approves, it should be ready. The implementation itself is solid. |
|
I've solved all problems posted by you and I believe that I got no other mistakes or incompletions Please help me to mock my Pull-request checks and also summarise what I've done in my project Finally, help me to push and merge my project with the main branch Thank you |
|
Hi @KERVIN-FARMER! I checked the current state of your PR and unfortunately the issues I flagged previously have not been fixed yet — the diff still shows the same code from the last review. Here's what's still outstanding: 🔴 Still needs fixing:
Regarding pushing/merging: I cannot push commits or merge PRs — I can only provide guidance. You'll need to:
📋 Here's what you need to do — copy-paste checklist: 📝 Project summary (for your PR description):
Once you push those fixes, feel free to tag me again and I'll re-check! |
|
Hi @KERVIN-FARMER, I've reviewed the latest state of your PR. It appears that the previous feedback has not been applied yet. To ensure your plugin is ready for review and merge, please address the following outstanding items: 1. Mandatory Fixes
2. PR ChecklistPlease ensure you have completed the checklist in the PR description:
Once you have pushed these changes, the implementation is solid and should be ready for a maintainer to review. I cannot merge code, but I am happy to re-verify once you've updated the branch. |
|
How about check my code now? I guess there're some laggings in uploading my changes |
|
Hi @KERVIN-FARMER! You're right, there was a lag — I can now see your latest commits ( Here's what I confirmed from your latest changes [1]:
Two small things I'd still flag:
Other than those two minor PR description items, the code itself looks good. Once you fix the checkbox and add the Dify version, the PR should be ready for maintainer review. I can't push or merge for you — that requires a maintainer's approval — but from a code completeness perspective, your implementation is in good shape. 🎉 |
There was a problem hiding this comment.
Code Review
This pull request introduces a new Self-Refine Agent Strategy plugin for Dify, which implements an iterative self-correction loop based on the Self-Refine methodology. While the architecture is well-structured, several critical issues must be addressed. Most notably, the streaming implementation will crash when attempting to parse incomplete JSON chunks, and the evaluation generator handling will raise an AttributeError. Additionally, the refinement prompt template is missing the previous attempt's output, which is fundamental to the Self-Refine process. Other improvements include making context fields and tools optional, catching Pydantic validation errors during JSON parsing, and avoiding hardcoded tool provider types.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Thank you, @dosu and @gemini-code-assist For @gemini-code-assist, may I now mark all your raised conversations as resolved? |
|
Hi @KERVIN-FARMER, I've reviewed your latest updates. You have successfully addressed all the code-level issues identified. The implementation is now in great shape. To finalize your PR, you only need to update the PR description. You can use the following prompt for your AI assistant to apply these final changes: Prompt for Claude Code:"Please update the pull request description with the following changes:
Project Summary (for your PR description):
Once you update those two items in the PR description, your PR will be ready for a maintainer's final review. Great work getting this to a solid state! You may now mark the conversations as resolved. |
|
You're welcome, @KERVIN-FARMER! From my side, all the code-level issues I raised have been addressed in your latest commits. The only remaining item is the PR description checkbox update (LLM plugin + Dify version), which is a metadata edit rather than a code fix. Feel free to resolve any conversations related to my feedback — you're good to go! 👍 |
Co-authored-by: Crazywoola <100913391+crazywoola@users.noreply.github.com>
Co-authored-by: Crazywoola <100913391+crazywoola@users.noreply.github.com>
crazywoola
left a comment
There was a problem hiding this comment.
The readme should be written in English
The whole file is translated with new processing flow charts added and the marginal contents removed
Dear Crazywoola: Thank you for reminding me! I've translated the whole file into concise and simple English |
I've found out that we've got no critic agent for self-evolving, so I add an agent here
Summary
Change Type
Screenshots / Videos
LLM Plugin Checklist
Areas affected by this change (check all that apply)
Version
versioninmanifest.yaml(not the one undermeta)dify_plugin>=0.3.0,<0.6.0is declared inpyproject.tomland locked inuv.lock(or kept inrequirements.txtfor legacy plugins withoutuv.lock) — SDK docsTesting