Skip to content

fix(facilitator): link webhooks to transactions; skip EVM agent register - #171

Merged
ds1 merged 2 commits into
masterfrom
fix/settle-bookkeeping
Oct 30, 2026
Merged

ds1 merged 2 commits into
masterfrom
fix/settle-bookkeeping

Conversation

@ds1

@ds1 ds1 commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Closes #165.

Changes (apps/facilitator/src/routes/settle.ts)

  • Webhook ↔ transaction link. The transaction insert now uses .returning({ id }), and the id is passed to dispatchWebhook (was hard-coded transactionId: undefined). webhook_deliveries.transaction_id is now populated, so deliveries can be joined back to their transaction.
  • No EVM payers in solanaAddress. Agent auto-registration runs only for solana:* networks. The agents table has no EVM address column, so EVM payments now record agentId = null instead of creating an agent with an 0x… address in solana_address.

Tests

  • e2e-solana-payment.test.ts: new "webhook delivery is linked to the recorded transaction". The mock DB's thenable now chains like a promise (passes the callback's return value down), so .returning() values propagate. Previously the mock silently dropped them.
  • e2e.test.ts: new "does not auto-register an EVM payer as a Solana agent".
  • Both new tests fail on the previous settle.ts and pass with this change.
  • Facilitator suite 77 passed / 10 skipped (two clean runs; one earlier run hit the known shutdown-load flake, Flaky test: shutdown-load concurrent requests under full suite #161). Typecheck clean.

Note

Touches a different part of settle.ts than the pending facilitator security PR, so the two should merge without conflict.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NbrZHvYoDo9HCJXRGkVjCF

- Return the transaction id from the settle insert and pass it to
  dispatchWebhook, so webhook_deliveries.transaction_id is populated.
- Only auto-register agents for Solana payers; EVM payers were being
  written into agents.solana_address.
- Make the Solana e2e mock DB chain like a promise so returned values
  propagate, and add tests for both fixes.

Closes #165

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NbrZHvYoDo9HCJXRGkVjCF
@vercel

vercel Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pincerpay-agent-demo Ready Ready Preview Oct 30, 2026 2:27pm UTC
pincerpay-dashboard Ready Ready Preview Oct 30, 2026 2:27pm UTC

Request Review

# Conflicts:
#	apps/facilitator/src/__tests__/e2e-solana-payment.test.ts
#	apps/facilitator/src/__tests__/e2e.test.ts

This branch was successfully deployed

2 active deployments
Preview – pincerpay-agent-demo — e7a1dffa Deployed Oct 30, 2026 by vercel[bot]
Preview – pincerpay-dashboard — e7a1dffa Deployed Oct 30, 2026 by vercel[bot]
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.

settle.ts: EVM payers saved as solanaAddress; webhook transactionId undefined

1 participant