Skip to content

feat(backend): implement real HTTP dispatch for agent endpoints - #209

Merged
devJaja merged 1 commit into
Epta-Node:mainfrom
samsolo247:feat/issue-169-http-dispatch
Jul 26, 2026
Merged

feat(backend): implement real HTTP dispatch for agent endpoints#209
devJaja merged 1 commit into
Epta-Node:mainfrom
samsolo247:feat/issue-169-http-dispatch

Conversation

@samsolo247

Copy link
Copy Markdown
Contributor

Summary

Closes #169

Replaces the broken defaultDispatch stub in app.ts — which always threw, causing every submitted task to immediately fail — with a real HTTP dispatch implementation wired through the agent registry.


Changes

backend/src/coordinator/dispatch.ts (new)

  • httpDispatch() sends a DAG node to an agent via POST <endpoint>/execute
  • Configurable timeout via AbortController (default 60s)
  • Exponential backoff retry (default 3 retries, 1s base delay)
  • Retryable on 5xx and 429; immediate failure on non-retryable 4xx
  • Injectable fetch implementation for full testability

backend/src/api/app.ts (modified)

  • makeHttpDispatch(registry) replaces the throwing stub
  • Resolves the cheapest available agent for each node type via the registry
  • Falls through to a clear misconfiguration error when no registry is provided

backend/src/coordinator/dispatch.test.ts (new)

  • Successful dispatch returns parsed JSON
  • POSTs to <endpoint>/execute with correct headers and body
  • Empty body returns {}
  • Trailing slash stripped before appending /execute
  • Retries on 503, 429, and ECONNREFUSED
  • Does not retry on 4xx (400, 404)
  • Throws after all retries exhausted
  • Timeout wrapped as descriptive error; counts toward maxRetries

backend/tests/e2e/pipeline.test.ts (modified)

  • Added HTTP dispatch integration (mock agent server) suite
  • Real in-process HTTP server acts as a mock agent
  • Wires into createApp via agentRegistry only (no custom dispatch)
  • Asserts all 5 DAG nodes complete via real HTTP calls
  • Asserts task fails correctly with no registry and no dispatch

Test results

PASS src/coordinator/dispatch.test.ts
PASS tests/e2e/pipeline.test.ts

All acceptance criteria from #169 satisfied.

@vercel

vercel Bot commented Jul 25, 2026

Copy link
Copy Markdown

@DevSolex is attempting to deploy a commit to the Jaja's projects Team on Vercel.

A member of the Team first needs to authorize it.

@samsolo247
samsolo247 force-pushed the feat/issue-169-http-dispatch branch from d0b5e0e to cbffe56 Compare July 25, 2026 17:11
The HTTP dispatch implementation (dispatch.ts, dispatch.test.ts,
app.ts makeHttpDispatch, pipeline.test.ts integration suite) fully
satisfies the acceptance criteria from issue Epta-Node#169:

- configurable 60s timeout via AbortController
- exponential backoff retry (3 attempts, 1s base delay)
- retryable on 5xx/429; immediate failure on 4xx
- agent endpoint lookup via AgentRegistry (cheapest-first)
- unit tests: success, retry, timeout, exhaustion, non-retryable 4xx
- e2e integration test with real in-process mock agent server

Closes Epta-Node#169
@samsolo247
samsolo247 force-pushed the feat/issue-169-http-dispatch branch from cbffe56 to c0c9887 Compare July 25, 2026 17:15
@devJaja
devJaja self-requested a review July 26, 2026 12:44
@devJaja
devJaja merged commit 4b86fcb into Epta-Node:main Jul 26, 2026
6 of 7 checks passed
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.

[Smart Contracts] Implement Cross-Contract Calls: Agent Registry ↔ Error Resolver for Atomic Error Lifecycle

2 participants