-
Notifications
You must be signed in to change notification settings - Fork 122
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(notAgentController.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
- Install agentic-flow v2.0.6 in a project
- Initialize claude-flow with AgentDB integration:
npx @claude-flow/cli@latest init --wizard
- Start the daemon:
npx @claude-flow/cli@latest daemon start
- 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:
- AgentDB v2.0.0-alpha.3.4 uses
/lib/controllers/BaseController.js - Runtime patch expects
/src/controllers/AgentController.js - Version detection logic is missing for different AgentDB releases
- 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