Skip to content

bug: GNNService incorrectly passes config.layers to RuvectorLayer constructor #118

@ruvnet

Description

@ruvnet

Issue Summary

Upstream Issue: ruvnet/RuVector#216

GNNService in agentic-flow incorrectly passes config.layers instead of config.heads to the RuvectorLayer constructor, causing dimension mismatch errors.

Problem

// Current (WRONG)
const layer = new RuvectorLayer(config.layers); // Should be config.heads

// Example: config = { heads: 8, layers: 3 }
// Result: Tries to create layer with 128 % 3 ≠ 0 (invalid)

Impact

  • Severity: Medium (GNN routing fails to initialize)
  • Affected: GNNService, gnn-tools.ts (6 MCP tools)
  • Workaround: Use correct head count in config
  • Fix Location: agentic-flow/src/services/gnn-router-service.ts

Root Cause

Two-part issue:

  1. agentic-flow (us): Passes wrong config parameter
  2. ruvector (upstream): Uses panic instead of Result (fatal in FFI)

Temporary Fix (Our Side)

```typescript
// In GNNService constructor

  • const layer = new RuvectorLayer(config.layers);
  • const layer = new RuvectorLayer(config.heads);
    ```

Upstream Fix Needed

@ruvector/gnn needs to return Result instead of panic:
```rust
// Current
pub fn new(num_heads: usize) -> Self {
assert!(EMBEDDING_DIM % num_heads == 0); // PANICS

// Proposed
pub fn new(num_heads: usize) -> Result<Self, GnnError> {
if EMBEDDING_DIM % num_heads != 0 {
return Err(GnnError::InvalidHeads { ... });
}
Ok(Self { ... })
}
```

Action Items

  • Fix GNNService parameter (agentic-flow)
  • Update tests to use correct config
  • Wait for upstream Result-based constructor
  • Update to @ruvector/gnn with proper error handling

Files to Update

  1. `agentic-flow/src/services/gnn-router-service.ts` - Fix constructor call
  2. `tests/integration/gnn-activation.test.ts` - Update test configs
  3. `agentic-flow/src/mcp/fastmcp/tools/gnn-tools.ts` - Add config validation

Related

Priority

P1 - Blocks GNN routing functionality, but has workaround.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions