Skip to content

Comments

fix: expand session MCP wiring + scheduling infinite loop#124

Merged
leonvanzyl merged 2 commits intoAutoForgeAI:masterfrom
rudiheydra:fix/expand-session-mcp-and-scheduling
Jan 29, 2026
Merged

fix: expand session MCP wiring + scheduling infinite loop#124
leonvanzyl merged 2 commits intoAutoForgeAI:masterfrom
rudiheydra:fix/expand-session-mcp-and-scheduling

Conversation

@rudiheydra
Copy link
Contributor

@rudiheydra rudiheydra commented Jan 28, 2026

Summary

  • fix: wire MCP server into ExpandChatSession for feature creation — The expand session (Web UI "Add Features" flow) was silently failing to create features because it had no MCP servers configured and only allowed Read/Glob tools. The prompt told Claude to call feature_create_bulk but the tool was unavailable. This wires the features MCP server into ExpandChatSession (matching how AssistantChatSession already works) and removes the duplicated direct-DB _create_features_bulk() method and <features_to_create> regex parsing.

  • fix: prevent infinite loop in compute_scheduling_scores with circular depsparallel_orchestrator.py could hang when computing scheduling scores if features had circular dependencies. Adds a visited set to break cycles.

Test plan

  • Start the UI (python start_ui.py), select a project with 100% features, click "Add Features"
  • Chat with Claude about new features, approve the list
  • Verify feature_create_bulk MCP tool is called and features appear on kanban board
  • Create features with circular dependencies, verify orchestrator does not hang

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Resolved infinite loop issue in the dependency scheduler when circular dependencies are present, preventing scheduling calculations from stalling and improving system stability.
  • Improvements

    • Enhanced feature creation workflow with updated system integration for more robust and efficient feature management operations.

✏️ Tip: You can customize this high-level summary in your review settings.

rudiheydra and others added 2 commits January 29, 2026 10:09
… deps

Add visited set to BFS algorithm to handle circular dependencies gracefully.
Previously, cycles in the dependency graph caused the orchestrator to hang
at 100% CPU indefinitely during startup.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace direct-DB feature creation with MCP tool path. The expand
session now configures the feature MCP server and allows
feature_create_bulk tool calls, matching how AssistantChatSession
already works. Removes duplicated _create_features_bulk() method
and <features_to_create> regex parsing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

This PR adds circular dependency handling to the BFS-based depth calculation and replaces the REST-based feature creation system with an MCP-based workflow. The first change prevents infinite loops from circular dependencies, while the second refactors feature creation to use MCP server tools instead of in-file parsing logic.

Changes

Cohort / File(s) Summary
Bug Fix: Circular Dependency Prevention
api/dependency_resolver.py
Added visited set to compute_scheduling_scores BFS algorithm to prevent infinite loops from circular dependencies. Nodes are now processed once with deduplication of enqueueing children.
Refactor: MCP-Based Feature Creation
server/services/expand_chat_session.py
Replaced REST-based feature creation with MCP-based workflow (feature_create_bulk). Removed in-file feature parsing logic, _create_features_bulk method, and regex parsing. Added EXPAND_FEATURE_TOOLS constant and MCP server configuration to Claude client initialization with bypassPermissions handling. Import changes: removed re, added sys.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A cycle was caught in our graph's gentle dance,
A visited set gives each node its chance.
REST gave way to MCP's bright tools,
Features now flow through smarter rules!
The chat expands with a cleaner way,
Round and round—but no more delay! 🔄

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes both main changes: MCP wiring fix for expand_chat_session and the infinite loop fix in compute_scheduling_scores for circular dependencies.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@leonvanzyl leonvanzyl merged commit 5f64ae3 into AutoForgeAI:master Jan 29, 2026
1 check passed
@leonvanzyl
Copy link
Collaborator

Thanks!

leonvanzyl added a commit that referenced this pull request Jan 29, 2026
- Fix settings inconsistency in ExpandChatSession: security_settings
  now uses "bypassPermissions" to match permission_mode parameter
- Add comprehensive tests for dependency resolver (12 tests):
  - Cycle detection in compute_scheduling_scores (critical fix from PR #124)
  - Self-reference handling
  - Diamond dependency patterns
  - would_create_circular_dependency validation
  - Dependency satisfaction checks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
CoreAspectStu pushed a commit to CoreAspectStu/autocoder-custom that referenced this pull request Feb 9, 2026
…-mcp-and-scheduling

fix: expand session MCP wiring + scheduling infinite loop
CoreAspectStu pushed a commit to CoreAspectStu/autocoder-custom that referenced this pull request Feb 9, 2026
- Fix settings inconsistency in ExpandChatSession: security_settings
  now uses "bypassPermissions" to match permission_mode parameter
- Add comprehensive tests for dependency resolver (12 tests):
  - Cycle detection in compute_scheduling_scores (critical fix from PR AutoForgeAI#124)
  - Self-reference handling
  - Diamond dependency patterns
  - would_create_circular_dependency validation
  - Dependency satisfaction checks

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants