Skip to content
This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Migrate PR #164: feat: check cycle error#1393

Merged
chao0kang merged 2 commits into
devfrom
feature/migrated-pr-164
Sep 5, 2025
Merged

Migrate PR #164: feat: check cycle error#1393
chao0kang merged 2 commits into
devfrom
feature/migrated-pr-164

Conversation

@arg-foo
Copy link
Copy Markdown
Contributor

@arg-foo arg-foo commented Sep 4, 2025

Description

This PR migrates 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

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 4, 2025

Codecov Report

❌ Patch coverage is 92.50000% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ent/Coordinator/WorkflowView/WorkflowViewGAgent.cs 92.50% 2 Missing and 1 partial ⚠️

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #1393      +/-   ##
==========================================
+ Coverage   39.88%   39.90%   +0.01%     
==========================================
  Files         637      637              
  Lines       25784    25824      +40     
  Branches     2416     2424       +8     
==========================================
+ Hits        10284    10304      +20     
- Misses      14897    14920      +23     
+ Partials      603      600       -3     
Flag Coverage Δ
unittests 39.90% <92.50%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...ent/Coordinator/WorkflowView/WorkflowViewGAgent.cs 80.55% <92.50%> (+4.59%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chao0kang chao0kang merged commit 3b95ecd into dev Sep 5, 2025
23 of 25 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants