Skip to content

[feat] Add trigger subscriptions and deliveries#4740

Draft
jp-agenta wants to merge 1 commit into
wp2-resolver-promotefrom
wp3-subscriptions
Draft

[feat] Add trigger subscriptions and deliveries#4740
jp-agenta wants to merge 1 commit into
wp2-resolver-promotefrom
wp3-subscriptions

Conversation

@jp-agenta

Copy link
Copy Markdown
Member

Context

With the triggers domain and catalog in place, this lane adds the two-table heart of the feature: subscriptions (a bound provider event plus a workflow to run) and deliveries (the record of each event that arrived). They are modeled directly on the existing webhook_subscriptions and webhook_deliveries tables.

Changes

Adds subscription CRUD and delivery reads:

  • trigger_subscriptions table: flags (enabled/valid) plus data, the Composio ti_* id, the trigger_config, the inputs_fields mapping template, the destination references/selector, the bound workflow ref, and a foreign key to the shared gateway_connections row. Many subscriptions can share one connection. The tables are domain-prefixed (trigger_*) to avoid colliding with the EE billing subscriptions table, matching the webhook_* naming.
  • trigger_deliveries table: the resolved inputs, workflow references, result/error, and an event_id dedup column unique per subscription. The dedup column is the idempotency store; there is no external one.
  • Subscription routes (/triggers/subscriptions/{,query,{id},{id}/refresh,{id}/revoke}) drive the Composio ti_* lifecycle through the adapter. Delivery routes (/triggers/deliveries/{,{id},query}) are read-only.
  • The DAO exposes get_subscription_by_trigger_id, write_delivery, and dedup_seen(event_id) for the later ingress lane to consume.

Deleting or revoking a subscription touches only the provider ti_*. It never revokes the shared connection, so other subscriptions and tools on that connection keep working.

Mapping is inputs-only for now: the inputs_fields template is resolved with the promoted resolver from the WP2 lane. Schema validation of the mapped inputs is left as a follow-up.

Tests / notes

  • Subscription/delivery acceptance tests run in both OSS and EE. The DB-only read/query/404 paths run unconditionally and prove the migration landed; the create-disable-delete path (and the assertion that the connection survives a subscription delete) is gated on COMPOSIO_API_KEY, matching the catalog and connections suites.
  • The migration oss000000003 is in the shared core_oss chain on top of the WP0 rename, so it runs in both editions.

Adds the two-table subscriptions/deliveries heart of the triggers domain,
modeled on webhook_subscriptions/webhook_deliveries. Subscriptions FK the
shared gateway_connections row and carry the inputs_fields mapping template;
deliveries record resolved inputs/result/error with an event_id dedup column.
Subscription CRUD drives the Composio ti_* lifecycle through the adapter;
deleting a subscription leaves the shared connection intact.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 18, 2026 4:34pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 569c528b-0363-4976-8077-fb4fa1514eff

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch wp3-subscriptions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant