Skip to content

feat: implement AI dispute mediation, webhook DLQ, GSN gas sponsorship, and collaborative config editing#555

Merged
Smartdevs17 merged 4 commits into
Smartdevs17:mainfrom
akintewe:feat/issues-452-453-454-455
Jun 28, 2026
Merged

feat: implement AI dispute mediation, webhook DLQ, GSN gas sponsorship, and collaborative config editing#555
Smartdevs17 merged 4 commits into
Smartdevs17:mainfrom
akintewe:feat/issues-452-453-454-455

Conversation

@akintewe

Copy link
Copy Markdown
Contributor

Summary

This PR implements four high-priority features across the AgenticPay platform:

Issue #452 — AI-Powered Payment Dispute Mediation System

  • backend/src/services/disputes/ai-mediator.ts: NLP signal extraction pipeline (fraud, non-delivery, quality, duplicate patterns), confidence-scored resolution classification, historical pattern boost, auto-resolution at >95% confidence, human escalation with AI-generated summary
  • backend/src/services/disputes/resolution-engine.ts: Full dispute lifecycle, SLA enforcement (72h deadline), mediator decision recording for continuous model improvement, analytics dashboard (resolution breakdown, SLA breach count, average resolution hours)
  • backend/src/routes/disputes-ai.ts: REST endpoints — POST /:id/mediate, POST /:id/human-resolve, GET /escalation-queue, GET /analytics, GET /:id/mediation-log

Issue #453 — Webhook Event Replay and Dead-Letter Queue Management

  • backend/src/services/webhooks/delivery-manager.ts: Configurable retry policy per endpoint (max retries, backoff multiplier, timeout, window days), delivery logs with status/latency/payload preview, success-rate health dashboard with <99% alert, CSV export
  • backend/src/services/webhooks/dead-letter-queue.ts: DLQ with permanent failure categorization (8 categories), single/batch/all replay, purge operations, sync from delivery logs, DLQ stats
  • backend/src/routes/webhooks-dlq.ts: REST endpoints — health, delivery-logs, CSV export, DLQ CRUD, replay (single/batch/all), endpoint retry policy management

Issue #454 — Gas Station Network for EVM Gas Sponsorship

  • contracts/evm/gsn/GSNForwarder.sol: EIP-2771/EIP-712 trusted forwarder with authorized relayer management, on-chain per-sender nonce tracking, replay protection
  • contracts/evm/gsn/SponsorshipPolicy.sol: On-chain merchant budget deposits, per-wallet daily rate limiting, relay-server billing integration, budget exhaustion events
  • backend/src/services/gsn/relay-server.ts: Meta-tx validation (signature format, deadline, replay protection), EIP-1559 fee estimation with configurable multiplier, nonce store, fallback-to-user-gas when budget exhausted
  • backend/src/services/gsn/budget-manager.ts: Per-merchant budget CRUD, top-up, rate-limit enforcement (rolling 24h window), gas spend recording, billing summaries
  • backend/src/routes/gsn.ts: REST endpoints — relay, estimate, budget management, billing summary, sponsored tx list

Issue #455 — Real-Time Collaborative Project Config Editing

  • backend/src/websocket/collaboration.ts: Socket.IO namespace handler with OT-based operation sync (<200ms), presence tracking with cursor positions, critical field locking (apiKey, webhookUrl, signingSecret), offline op queue/replay on reconnect, edit history with per-user attribution and rollback
  • backend/src/routes/collaboration.ts: REST endpoints — edit history, active participants, locked fields
  • frontend/components/collaboration/useCollaboration.ts: React hook — Socket.IO client, operation send with 300ms debounce, offline queue flush on reconnect, lock acquire/release Promise API
  • frontend/components/collaboration/PresenceIndicators.tsx: Avatar stack with cursor field tooltip, active dot indicator, overflow counter
  • frontend/components/collaboration/CollaborativeField.tsx: Input with remote cursor indicator, lock state visual styles, critical field lock acquire/release on focus/blur
  • frontend/components/collaboration/EditHistoryPanel.tsx: Slide-in panel with per-user attributed history, version display, rollback with confirmation dialog
  • frontend/components/collaboration/CollaborativeProjectConfig.tsx: Full project config form wired to collaboration hook — general, redirect, and critical security fields

Test plan

  • Trigger AI mediation on a dispute and verify auto-resolve at high confidence vs. escalation queue at low confidence
  • Submit events to a webhook endpoint, verify DLQ population on failures, replay single/batch entries
  • Create a merchant GSN budget, submit meta-transaction, verify budget deduction and fallback when exhausted
  • Open project config as two users simultaneously, verify real-time sync, presence indicators, lock behavior on critical fields, and history rollback

closes #452 closes #453 closes #454 closes #455

akintewe added 4 commits June 28, 2026 11:41
- Add ai-mediator.ts: NLP signal extraction, pattern-based classification,
  confidence scoring, auto-resolution at >95% confidence, human escalation
- Add resolution-engine.ts: dispute lifecycle management, SLA enforcement,
  mediator decision recording, analytics dashboard data
- Add disputes-ai.ts route: mediate, human-resolve, escalation-queue,
  analytics, and mediation-log endpoints
…nager

- Add delivery-manager.ts: configurable retry policies per endpoint,
  delivery logs with latency/status/payload preview, health dashboard
  with 99% success rate alerting, CSV export of delivery logs
- Add dead-letter-queue.ts: permanent failure categorization, single/batch/
  all replay from DLQ, purge operations, DLQ stats
- Add webhooks-dlq.ts route: health, delivery-logs, DLQ CRUD, replay,
  endpoint retry policy management, CSV export endpoint
…sorship

- Add GSNForwarder.sol: EIP-2771/EIP-712 meta-transaction forwarder with
  authorized relayer management and on-chain nonce tracking
- Add SponsorshipPolicy.sol: on-chain budget deposits, per-wallet rate
  limiting, and relay-server billing integration
- Add relay-server.ts: meta-tx validation, EIP-1559 fee estimation with
  configurable multiplier, Redis-compatible nonce store, budget check,
  fallback-to-user-gas when budget exhausted
- Add budget-manager.ts: per-merchant budget CRUD, top-up, rate-limit
  enforcement, gas spend recording, billing summaries
- Add gsn.ts route: relay, estimate, budget management endpoints
…ig editing

- Add collaboration.ts WS handler: OT-based operation sync, presence
  tracking, critical-section locks (apiKey, webhookUrl, signingSecret),
  offline op queue/replay, per-user edit history with rollback
- Add collaboration.ts REST route: history, participants, locked fields
- Add useCollaboration hook: Socket.IO client, operation send with 300ms
  debounce, offline queue flush on reconnect, lock acquire/release
- Add PresenceIndicators: avatar stack with cursor field tooltip
- Add CollaborativeField: input with remote cursor, lock state styles
- Add EditHistoryPanel: per-user attributed history with rollback confirm
- Add CollaborativeProjectConfig: full project config form wired to collab
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

@akintewe is attempting to deploy a commit to the smartdevs17's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Jun 28, 2026

Copy link
Copy Markdown

@akintewe Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Smartdevs17 Smartdevs17 merged commit 3b094f9 into Smartdevs17:main Jun 28, 2026
23 of 47 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

2 participants