Skip to content

Conversation

@sundog75
Copy link

@sundog75 sundog75 commented Jan 24, 2026

Problem

When adding features to existing projects via the "Add Features" / expand project flow, Claude reports it "could not access the MCP tool required to add features" and asks users to add them manually.

Root cause: The ExpandChatSession class does NOT configure an MCP server, while AssistantChatSession does. This means Claude cannot use feature_create_bulk or feature_create MCP tools during project expansion.

Solution

Added MCP server configuration to ExpandChatSession, matching the pattern used in AssistantChatSession:

  • Added EXPAND_FEATURE_TOOLS constant for feature_create, feature_create_bulk, and feature_get_stats
  • Added MCP server configuration pointing to mcp_server.feature_mcp
  • Updated allowed_tools and security settings to include feature tools

Testing

  1. Start the UI
  2. Select an existing project with features
  3. Click "Add Features" or use the expand feature flow
  4. Ask Claude to add a new feature
  5. Verify feature appears in the Kanban board (no manual addition required)

Notes

Summary by CodeRabbit

  • New Features

    • Chat sessions now include additional feature tools at session start.
    • Multi-processor server support enabled to power those tools.
    • Added a tool to fetch passing features for regression workflows, with automatic regression count tracking.
  • Chores

    • Added legacy-compatible database fields and a migration to preserve data and track regression counts.

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

Added EXPAND_FEATURE_TOOLS and MCP setup to the expand chat session service; initialized ClaudeSDKClient with mcp_servers and updated allowed tools; added Feature.regression_count plus legacy columns and migration support; added MCP tool feature_get_for_regression(limit) for selecting and incrementing passing features.

Changes

Cohort / File(s) Summary
Expand chat session service
server/services/expand_chat_session.py
Added EXPAND_FEATURE_TOOLS constant; imported sys; built mcp_servers entry to run mcp_server.feature_mcp with PROJECT_DIR/PYTHONPATH env; passed mcp_servers into ClaudeSDKClient; included EXPAND_FEATURE_TOOLS in security allowed_tools and initial allowed tools.
Database — Feature model & migration
api/database.py
Added columns to Feature: regression_count: Column(Integer, nullable=False, default=0, index=True), plus legacy testing_in_progress: Column(Boolean, nullable=False, default=False) and last_tested_at: Column(DateTime, nullable=True, default=None); updated to_dict() to include regression_count; added migration helper to add regression_count to existing DBs and invoked it during DB init/create.
MCP server — regression tool
mcp_server/feature_mcp.py
Added public tool feature_get_for_regression(limit: Annotated[int, Field(default=3, ge=1, le=10)] = 3) -> str that selects passing features ordered by regression_count, acquires row locks, increments regression_count, commits/refreshes, and returns a JSON payload; removed RegressionInput model.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant ExpandService as "Expand Service"
    participant Env as Environment
    participant ClaudeClient as "ClaudeSDKClient"
    participant MCP as "feature_mcp (MCP Server)"
    participant DB as Database

    Client->>ExpandService: request expand chat session
    ExpandService->>Env: prepare env vars (PROJECT_DIR, PYTHONPATH)
    ExpandService->>MCP: declare/start feature_mcp via mcp_servers
    ExpandService->>ClaudeClient: init with mcp_servers + EXPAND_FEATURE_TOOLS
    ClaudeClient->>MCP: invoke feature tool (feature_get_for_regression)
    MCP->>DB: query passing features ordered by regression_count
    DB-->>MCP: return features
    MCP->>DB: increment regression_count, commit
    DB-->>MCP: confirm update
    MCP-->>ClaudeClient: return feature payload
    ClaudeClient-->>ExpandService: receive tool result
    ExpandService-->>Client: return expanded session
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I hopped through code with nimble feet,

counting regressions, tools to meet,
MCP whispers, DB replies,
Claude and I trade bright surprise,
a rabbit cheers for every feat.

🚥 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 accurately reflects the main changes: adding MCP server configuration to ExpandChatSession to enable feature creation functionality.
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.

When adding features to existing projects, the ExpandChatSession was
unable to use feature creation MCP tools because it lacked the MCP
server configuration that AssistantChatSession has.

This commit adds:
- EXPAND_FEATURE_TOOLS constant for feature_create, feature_create_bulk,
  and feature_get_stats MCP tools
- MCP server configuration pointing to mcp_server.feature_mcp
- Updated allowed_tools and security settings to include feature tools

The existing XML parsing fallback continues to work as defense-in-depth
if MCP fails.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sundog75 sundog75 force-pushed the fix/expand-feature-mcp-access branch from cff1808 to 32ec92e Compare January 24, 2026 01:52
Existing databases have testing_in_progress (NOT NULL) and last_tested_at
columns from before commit 486979c. Re-add them to the Feature model with
defaults to prevent NOT NULL violations when creating features via MCP.

The columns are no longer used by the application but must exist in the
model so SQLAlchemy populates them on INSERT.

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@api/database.py`:
- Around line 61-66: The migration function _migrate_add_testing_columns is
currently a no-op but must add the deprecated columns for DBs created after
their removal; update _migrate_add_testing_columns to check the target table
schema (e.g., via inspector or PRAGMA) for the absence of testing_in_progress
and last_tested_at and, if missing, execute DDL to ALTER TABLE and add
testing_in_progress BOOLEAN NOT NULL DEFAULT FALSE and last_tested_at DATETIME
NULL (or equivalent for SQLite), ensuring the column definitions match the
SQLAlchemy model defaults and nullability and that the operation is safe (wrap
in try/except and commit/rollback as in existing migration patterns). Ensure the
function references the same table name used by the model and handles both
SQLite and other RDBMS dialect nuances when issuing ALTER statements.

Comment on lines +61 to +66
# DEPRECATED: Kept for backward compatibility with existing databases.
# These columns are no longer used but prevent NOT NULL violations on insert.
# Removed in commit 486979c but old databases still have them.
testing_in_progress = Column(Boolean, nullable=False, default=False)
last_tested_at = Column(DateTime, nullable=True, default=None)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Migration gap: databases created after column removal won't have these columns.

The columns are added to the model, but _migrate_add_testing_columns() (lines 241-253) is a no-op. This creates a problem for databases that were created after the columns were removed in commit 486979c but before this PR—they won't have these columns, and INSERT operations will fail.

Consider updating _migrate_add_testing_columns to actually add the columns if missing:

Proposed fix for _migrate_add_testing_columns
 def _migrate_add_testing_columns(engine) -> None:
-    """Legacy migration - no longer adds testing columns.
-
-    The testing_in_progress and last_tested_at columns were removed from the
-    Feature model as part of simplifying the testing agent architecture.
-    Multiple testing agents can now test the same feature concurrently
-    without coordination.
-
-    This function is kept for backwards compatibility but does nothing.
-    Existing databases with these columns will continue to work - the columns
-    are simply ignored.
-    """
-    pass
+    """Add testing columns for backward compatibility.
+
+    These columns are deprecated but required in the model so SQLAlchemy
+    populates them on INSERT (preventing NOT NULL violations in old databases).
+    """
+    with engine.connect() as conn:
+        result = conn.execute(text("PRAGMA table_info(features)"))
+        columns = [row[1] for row in result.fetchall()]
+
+        if "testing_in_progress" not in columns:
+            conn.execute(text(
+                "ALTER TABLE features ADD COLUMN testing_in_progress BOOLEAN DEFAULT 0"
+            ))
+        if "last_tested_at" not in columns:
+            conn.execute(text(
+                "ALTER TABLE features ADD COLUMN last_tested_at DATETIME DEFAULT NULL"
+            ))
+        conn.commit()
🤖 Prompt for AI Agents
In `@api/database.py` around lines 61 - 66, The migration function
_migrate_add_testing_columns is currently a no-op but must add the deprecated
columns for DBs created after their removal; update _migrate_add_testing_columns
to check the target table schema (e.g., via inspector or PRAGMA) for the absence
of testing_in_progress and last_tested_at and, if missing, execute DDL to ALTER
TABLE and add testing_in_progress BOOLEAN NOT NULL DEFAULT FALSE and
last_tested_at DATETIME NULL (or equivalent for SQLite), ensuring the column
definitions match the SQLAlchemy model defaults and nullability and that the
operation is safe (wrap in try/except and commit/rollback as in existing
migration patterns). Ensure the function references the same table name used by
the model and handles both SQLite and other RDBMS dialect nuances when issuing
ALTER statements.

Implements the regression_count column and feature_get_for_regression MCP tool
to ensure even distribution of regression testing across all passing features.

Changes:
- Add regression_count column to Feature model with migration
- Add feature_get_for_regression MCP tool that:
  - Returns passing features ordered by regression_count (ascending)
  - Increments count after selection for round-robin behavior
  - Prevents duplicate testing of same features
- Remove unused RegressionInput class

Based on PR leonvanzyl#47 by connor-tyndall, cleanly reimplemented to avoid merge conflicts.

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@mcp_server/feature_mcp.py`:
- Around line 304-352: The feature_get_for_regression function currently reads
Feature.regression_count and then updates it in-memory, which allows lost
increments under concurrent requests; change the selection/update to perform
row-level locking or an atomic update: use
session.query(Feature).with_for_update().filter(Feature.passes ==
True).order_by(Feature.regression_count.asc(), Feature.id.asc()).limit(limit) to
lock rows before incrementing regression_count, then increment and commit (or
perform an UPDATE ... RETURNING to atomically increment regression_count and
fetch the rows), ensure session.commit() and session.refresh(...) are used after
the locked/atomic update so returned features reflect the new counts.
♻️ Duplicate comments (1)
api/database.py (1)

61-65: Missing migration for deprecated testing columns can break inserts.

Adding testing_in_progress / last_tested_at to the model means SQLAlchemy will include them in INSERTs; databases created after their removal but before this change won’t have those columns and will error. _migrate_add_testing_columns() is still a no‑op, so this gap persists.

🛠️ Suggested fix (in _migrate_add_testing_columns)
 def _migrate_add_testing_columns(engine) -> None:
-    """Legacy migration - no longer adds testing columns.
-
-    The testing_in_progress and last_tested_at columns were removed from the
-    Feature model as part of simplifying the testing agent architecture.
-    Multiple testing agents can now test the same feature concurrently
-    without coordination.
-
-    This function is kept for backwards compatibility but does nothing.
-    Existing databases with these columns will continue to work - the columns
-    are simply ignored.
-    """
-    pass
+    """Add testing columns if missing (backward compatibility)."""
+    with engine.connect() as conn:
+        result = conn.execute(text("PRAGMA table_info(features)"))
+        columns = [row[1] for row in result.fetchall()]
+        if "testing_in_progress" not in columns:
+            conn.execute(text(
+                "ALTER TABLE features ADD COLUMN testing_in_progress BOOLEAN DEFAULT 0"
+            ))
+        if "last_tested_at" not in columns:
+            conn.execute(text(
+                "ALTER TABLE features ADD COLUMN last_tested_at DATETIME DEFAULT NULL"
+            ))
+        conn.commit()

Use with_for_update() to acquire locks before reading features in
feature_get_for_regression. This prevents concurrent requests from
both selecting the same features and losing increment updates.

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

pandel commented Jan 24, 2026

As you referenced my issue, I tested this PR:

  • adding features via AI chat dialog worked now
  • permissions to use WbeFetch or WebSearch are still not available

rudiheydra added a commit to rudiheydra/AutoBuildr that referenced this pull request Jan 27, 2026
…onvanzyl#88)

- Created tests/test_validate_dependency_graph_complex_cycles.py (19 tests)
- Verified complex cycles (A->B->C->A) are detected with full path [1, 2, 3]
- Verified missing dependencies are also detected alongside cycles
- All cycle issues correctly marked as auto_fixable=False (requires user action)
- Updated claude-progress.txt with session notes

Feature leonvanzyl#88 marked as PASSING.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
getworken pushed a commit to getworken/autocoder that referenced this pull request Jan 27, 2026
getworken pushed a commit to getworken/autocoder that referenced this pull request Jan 27, 2026
SUMMARY:
Fixed TypeScript build error in ProjectSetupRequired.tsx where startAgent
was being called with a boolean instead of an options object.

DETAILS:
- The startAgent API function signature was updated (in previous PR merges)
  to accept an options object: { yoloMode?, parallelMode?, maxConcurrency?, testingAgentRatio? }
- ProjectSetupRequired.tsx was still calling it with the old signature:
  startAgent(projectName, yoloMode) - passing boolean directly
- Changed to: startAgent(projectName, { yoloMode }) - wrapping in options object

This was the only remaining build error after merging 13+ PRs from upstream:
- PR leonvanzyl#112: Security vulnerabilities and race conditions
- PR leonvanzyl#89: Windows subprocess blocking fix
- PR leonvanzyl#109: Rate limit handling with exponential backoff
- PR leonvanzyl#88: MCP server config for ExpandChatSession
- PR leonvanzyl#100: Diagnostic warnings for config loading
- PR leonvanzyl#110: Quality gates (quality_gates.py)
- PR leonvanzyl#113: Structured logging (structured_logging.py)
- PR leonvanzyl#48: Knowledge files support (API, schemas, prompts)
- PR leonvanzyl#29: Feature editing/deletion (MCP tools)
- PR leonvanzyl#45: Chat persistence
- PR leonvanzyl#52: Refactoring feature guidance
- PR leonvanzyl#4: Project reset functionality
- PR leonvanzyl#95: UI polish, health checks, cross-platform fixes

Build now passes: npm run build succeeds with all 2245 modules transformed.
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