ruvnet / ruvnet/agentic-flow

[Bug] AgentDB runtime patch uses incorrect controller path for v2.x compatibility

Open
#111 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
812
Forks
175
Avg merge
2m
Merged PRs (30d)
3

Description

🐛 Bug Report

Problem Description

The AgentDB runtime patch system is attempting to use an incorrect controller path when patching for v2.x compatibility, resulting in a warning message during initialization:

Warning: Failed to patch AgentDB controller - path not found: /workspaces/jlmaworkspace/.claude-flow/node_modules/agentdb/src/controllers/AgentController.js
Root Cause Analysis

File: .claude-flow/lib/agentdb/runtime-patch.js (lines 15-20)
Issue: The patch system constructs the controller path using a hardcoded pattern that doesn't match the actual AgentDB v2.0.0-alpha.3.4 file structure.

Current problematic code:

const controllerPath = path.join(nodeModulesPath, 'agentdb', 'src', 'controllers', 'AgentController.js');

Actual AgentDB v2.x structure:

  • Controllers are located in /lib/controllers/ (not /src/controllers/)
  • Main controller is BaseController.js (not AgentController.js)
Environment Details
  • AgentDB Version: v2.0.0-alpha.3.4
  • Agentic-Flow Version: v2.0.6
  • Node.js: Latest LTS
  • Platform: Linux (Codespaces/Dev Container)
  • Installation: npm/npx based
Reproduction Steps
  1. Install agentic-flow v2.0.6 in a project
  2. Initialize claude-flow with AgentDB integration:
    npx @claude-flow/cli@latest init --wizard
    
  3. Start the daemon:
    npx @claude-flow/cli@latest daemon start
    
  4. Observe the warning message in console output
Expected vs Actual Behavior

Expected:

  • Silent patching of AgentDB controllers for v2.x compatibility
  • No warning messages during normal operation
  • Successful runtime patching when needed

Actual:

  • Warning message appears: "Failed to patch AgentDB controller - path not found"
  • Patch attempt fails due to incorrect path resolution
  • System continues to function (graceful degradation)
Proposed Solution

Update the path resolution logic in runtime-patch.js to correctly identify AgentDB v2.x structure:

// Current problematic code
const controllerPath = path.join(nodeModulesPath, 'agentdb', 'src', 'controllers', 'AgentController.js');

// Proposed fix - detect AgentDB version and use appropriate path
const detectAgentDBStructure = (nodeModulesPath) => {
  const v2Path = path.join(nodeModulesPath, 'agentdb', 'lib', 'controllers', 'BaseController.js');
  const v1Path = path.join(nodeModulesPath, 'agentdb', 'src', 'controllers', 'AgentController.js');
  
  if (fs.existsSync(v2Path)) {
    return { path: v2Path, version: 'v2.x' };
  } else if (fs.existsSync(v1Path)) {
    return { path: v1Path, version: 'v1.x' };
  }
  return null;
};
Impact Assessment

Severity: Low (Warning Only)

  • ⚠️ No functional breakage - system continues to operate normally
  • ⚠️ Cosmetic issue - warning message may confuse users
  • ⚠️ Runtime patches for AgentDB compatibility are not applied
  • ✅ All core functionality remains intact
Technical Analysis

Files Investigated:

  • .claude-flow/lib/agentdb/runtime-patch.js - Contains the problematic path logic
  • .claude-flow/node_modules/agentdb/ - Confirmed v2.x file structure
  • Package manifests - Verified version compatibility matrix

Evidence:

  1. AgentDB v2.0.0-alpha.3.4 uses /lib/controllers/BaseController.js
  2. Runtime patch expects /src/controllers/AgentController.js
  3. Version detection logic is missing for different AgentDB releases
  4. Graceful fallback prevents system failure
Additional Context

This bug likely emerged during the transition from AgentDB v1.x to v2.x where the internal file structure was reorganized. The runtime patch system needs to be updated to handle both legacy and current AgentDB versions.

Related Components:

  • AgentDB integration layer
  • Runtime patching system
  • Version compatibility matrix
  • Developer experience (warning messages)
Acceptance Criteria
  • No warning messages during normal agentic-flow initialization
  • Runtime patches apply correctly for both AgentDB v1.x and v2.x
  • Version detection automatically selects appropriate controller path
  • Backward compatibility maintained for existing installations
  • Clear error handling if neither path structure is found

Environment: Development Container (Linux)
Priority: Medium (UX improvement)
Labels: bug, agentdb, compatibility, v2.x, runtime-patch

🤖 Generated with Claude Code - Issue Tracker

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in .claude-flow/lib/agentdb/runtime-patch.js, especially lines 15-20, and inspect the AgentDB v1.x and v2.x paths described in the issue. Reproduce with npx @claude-flow/cli@latest init --wizard and daemon start, then verify that both supported layouts are handled without the warning and that a missing layout has clear error handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.