This repository was archived by the owner on Mar 31, 2026. It is now read-only.
feat: check cycle error#164
Open
chao0kang wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
🚀 New features to boost your workflow:
|
chao0kang
added a commit
to aevatarAI/aevatar-station
that referenced
this pull request
Sep 5, 2025
## Description This PR migrates [aevatarAI/aevatar-gagents#164](aevatarAI/aevatar-gagents#164) to the aevatar-station repository. ### Original PR Details - **Author**: chao0kang (chao.kang@aelf.io) - **Title**: feat: check cycle error - **Branch**: feature/fix-workflow-view-cycle ### Changes Made This PR adds cycle detection to the WorkflowViewGAgent to prevent circular dependencies in workflow graphs. The implementation includes: 1. **Cycle Detection Algorithm**: Implements Kahn's algorithm for topological sorting to detect cycles in the workflow graph 2. **Self-Loop Detection**: Explicitly checks for and rejects self-referencing nodes 3. **Error Handling**: Throws ArgumentException with clear error message when cycles are detected ### Files Modified - `gagents/src/Aevatar.GAgents.GroupChat/GAgent/Coordinator/WorkflowView/WorkflowViewGAgent.cs` - Added HasCycle method and cycle validation in PerformConfigAsync - `gagents/test/Aevatar.GAgents.GroupChat.Test/Tests/WorkFlowViewTest.cs` - Added two unit tests to verify cycle detection works correctly ### Testing - All existing tests pass ✅ - Added two new tests: - `WorkflowViewTest_Should_Throw_When_SelfLoopExists` - Tests self-loop detection - `WorkflowViewTest_Should_Throw_When_CycleExists` - Tests general cycle detection ### Migration Details - Migrated using `git cherry-pick -X subtree=gagents f2c47e3c` - All changes correctly placed in the `gagents/` subdirectory - Build and tests completed successfully Co-authored-by: chao0kang <chao.kang@aelf.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.