Skip to content

feat(github): deliver webhook events to Mesh via trigger callbacks#332

Open
viktormarinho wants to merge 1 commit intomainfrom
viktormarinho/trigger-callback
Open

feat(github): deliver webhook events to Mesh via trigger callbacks#332
viktormarinho wants to merge 1 commit intomainfrom
viktormarinho/trigger-callback

Conversation

@viktormarinho
Copy link
Contributor

@viktormarinho viktormarinho commented Mar 24, 2026

Summary

  • Stores callback URL and token provided via TRIGGER_CONFIGURE in a per-connection credentials map
  • On webhook match, POSTs the full event payload to Mesh's trigger-callback endpoint using stored credentials
  • Fire-and-forget delivery with error logging on failure
  • Callback credentials are automatically cleaned up when all triggers for a connection are disabled

Test plan

  • Configure a trigger with callbackUrl and callbackToken via TRIGGER_CONFIGURE
  • Send a matching webhook event and verify the callback POST is made to the correct URL with Bearer auth
  • Disable all triggers for a connection and verify credentials are cleaned up
  • Verify non-matching events do not trigger callbacks
  • Verify missing callback credentials logs a warning instead of crashing

🤖 Generated with Claude Code


Summary by cubic

Delivers GitHub webhook events to Mesh via per-connection trigger callbacks. Stores callback URL and token from TRIGGER_CONFIGURE, posts matched events to the Mesh callback endpoint, and cleans up credentials when no triggers remain.

  • New Features
    • Save callbackUrl and callbackToken per connection during TRIGGER_CONFIGURE.
    • On trigger match, POST the full event payload to the callback URL with Bearer auth (fire-and-forget with error logging).
    • Remove callback credentials when all triggers for a connection are disabled.
    • Extend the trigger configure tool to accept and pass callback fields.

Written for commit 1bb576b. Summary will update on new commits.

Store callback URL and token from TRIGGER_CONFIGURE, then POST event
payloads to Mesh's trigger-callback endpoint on webhook match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="github/server/webhook.ts">

<violation number="1" location="github/server/webhook.ts:66">
P1: Non-2xx callback responses are treated as success because only rejected fetches are caught; failed deliveries (e.g., 401/500) will not be logged.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

const credentials = getCallbackCredentials(connectionId);
if (credentials) {
// Fire-and-forget callback to Mesh
fetch(credentials.callbackUrl, {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Non-2xx callback responses are treated as success because only rejected fetches are caught; failed deliveries (e.g., 401/500) will not be logged.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At github/server/webhook.ts, line 66:

<comment>Non-2xx callback responses are treated as success because only rejected fetches are caught; failed deliveries (e.g., 401/500) will not be logged.</comment>

<file context>
@@ -59,6 +59,38 @@ export async function handleGitHubWebhook(req: Request): Promise<Response> {
+    const credentials = getCallbackCredentials(connectionId);
+    if (credentials) {
+      // Fire-and-forget callback to Mesh
+      fetch(credentials.callbackUrl, {
+        method: "POST",
+        headers: {
</file context>
Fix with Cubic

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