π― Objective
CRITICAL / URGENT β Fix the complete agent dispatch pipeline failure. The coordinator's defaultDispatch always throws, meaning every task submitted fails immediately during execution. The entire multi-agent coordination system is non-functional.
π Files to Modify
| Action |
File Path |
Description |
| Modify |
backend/src/api/app.ts |
Replace defaultDispatch with HTTP dispatch |
| Modify |
backend/src/coordinator/coordinator.ts |
Accept dispatch function parameter |
π Files to Create
| Action |
File Path |
Description |
| Create |
backend/src/coordinator/dispatch.ts |
HTTP dispatch with retries, timeouts, agent lookup |
π Files to Modify (Tests)
| Action |
File Path |
Description |
| Modify |
backend/tests/e2e/pipeline.test.ts |
Add real HTTP dispatch test |
| Create |
backend/src/coordinator/dispatch.test.ts |
Unit tests for dispatch |
π Root Cause Analysis
// backend/src/api/app.ts β line 397
const defaultDispatch = async (nodeId: string, task: any) => {
throw new Error('No dispatch implementation configured'); // β ALWAYS THROWS
};
The coordinator calls dispatch() for each DAG node. Since defaultDispatch always throws:
- Task is created in database β
- DAG is decomposed β
- Coordinator starts executing nodes β
dispatch() is called β throws immediately β
- All nodes marked as
failed β
- Task status becomes
failed β
π₯ Impact (Severity: CRITICAL)
- 100% of submitted tasks fail during execution
- The entire agent coordination pipeline is dead
- Research, Risk, Coding, Design, Report agents are never invoked
- Payment layer never triggers (no nodes complete)
- Frontend shows all tasks as "failed" immediately after submission
- The core product value proposition is broken
β
Expected Implementation
Create backend/src/coordinator/dispatch.ts
import { SubTask } from '../types/task';
import { getAgentRegistry } from '../agents/registry';
interface DispatchOptions {
timeoutMs: number;
maxRetries: number;
retryDelayMs: number;
}
const DEFAULT_OPTIONS: DispatchOptions = {
timeoutMs: 60_000,
maxRetries: 3,
retryDelayMs: 1_000,
};
export async function httpDispatch(
subtask: SubTask,
options: DispatchOptions = DEFAULT_OPTIONS
): Promise<any> {
const registry = getAgentRegistry();
const agent = registry.lookupAgent(subtask.type);
if (!agent) {
throw new Error(`No agent available for type: ${subtask.type}`);
}
let lastError: Error | null = null;
for (let attempt = 0; attempt <= options.maxRetries; attempt++) {
try {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), options.timeoutMs);
const response = await fetch(agent.endpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(subtask),
signal: controller.signal,
});
clearTimeout(timeout);
if (!response.ok) {
throw new Error(`Agent ${agent.id} returned ${response.status}`);
}
return await response.json();
} catch (err) {
lastError = err as Error;
if (attempt < options.maxRetries) {
await new Promise(r => setTimeout(r, options.retryDelayMs * Math.pow(2, attempt)));
}
}
}
throw lastError;
}
Update app.ts
import { httpDispatch } from '../coordinator/dispatch';
// Replace defaultDispatch
const dispatch = async (nodeId: string, task: SubTask) => {
return httpDispatch(task);
};
π Reference Files
| File Path |
Lines |
Issue |
backend/src/api/app.ts |
397 |
defaultDispatch always throws |
backend/src/coordinator/coordinator.ts |
~50 |
Where dispatch is called |
backend/src/agents/registry.ts |
β |
Agent endpoint lookup |
backend/src/types/task.ts |
β |
SubTask type |
backend/src/services/venice/client.ts |
β |
Retry pattern reference |
β
Acceptance Criteria
π― Objective
CRITICAL / URGENT β Fix the complete agent dispatch pipeline failure. The coordinator's
defaultDispatchalways throws, meaning every task submitted fails immediately during execution. The entire multi-agent coordination system is non-functional.π Files to Modify
backend/src/api/app.tsdefaultDispatchwith HTTP dispatchbackend/src/coordinator/coordinator.tsπ Files to Create
backend/src/coordinator/dispatch.tsπ Files to Modify (Tests)
backend/tests/e2e/pipeline.test.tsbackend/src/coordinator/dispatch.test.tsπ Root Cause Analysis
The coordinator calls
dispatch()for each DAG node. SincedefaultDispatchalways throws:dispatch()is called β throws immediately βfailedβfailedβπ₯ Impact (Severity: CRITICAL)
β Expected Implementation
Create
backend/src/coordinator/dispatch.tsUpdate
app.tsπ Reference Files
backend/src/api/app.tsbackend/src/coordinator/coordinator.tsbackend/src/agents/registry.tsbackend/src/types/task.tsbackend/src/services/venice/client.tsβ Acceptance Criteria
backend/src/coordinator/dispatch.tsdefaultDispatchinapp.tsbackend/src/coordinator/dispatch.test.ts