Skip to content

fix(forge-sync): correct inbound webhook routing and webhook path alignment#433

Open
AnuragGupta181 wants to merge 2 commits into
LF-Decentralized-Trust-labs:mainfrom
AnuragGupta181:fix/forge-webhook-routing
Open

fix(forge-sync): correct inbound webhook routing and webhook path alignment#433
AnuragGupta181 wants to merge 2 commits into
LF-Decentralized-Trust-labs:mainfrom
AnuragGupta181:fix/forge-webhook-routing

Conversation

@AnuragGupta181

@AnuragGupta181 AnuragGupta181 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

PR Title

fix(forge-sync): correct inbound webhook routing and webhook path alignment

Summary

This PR resolves the highest-priority Phase 0 issue identified during the Forge Integration Service assessment.

Root Cause

GitHub webhooks were registered with the callback URL:

/api/forge/webhook/github

However, the webhook handlers were mounted under:

/api/projects/forge/webhook/github

This routing mismatch caused all inbound GitHub webhook deliveries to return HTTP 404, preventing real-time synchronization and agent wakeups.

Changes Made

  • Split forge webhook routes into:

    • forgeWebhookManagementRoutes
    • forgeWebhookInboundRoutes
  • Mounted inbound webhook routes at:

    • /api/forge/webhook/github
    • /api/forge/webhook/gitlab
    • /api/forge/webhook/forgejo
  • Kept management routes under project-scoped paths

  • Updated route exports and wiring

  • Updated webhook documentation

  • Aligned inbound routing with existing Tekton webhook architecture

Outcome

Inbound webhook requests now reach the correct handler and no longer fail with HTTP 404 responses.

During validation, an additional issue was discovered:

withResolvedProjectId()

currently depends on:

__gitmesh_project_id

which is unavailable in the new inbound webhook execution path.

This causes webhook processing to fail after routing succeeds and will be addressed in a follow-up PR.

Related Issue

Fixes #431

Type of Change

  • fix
  • docs

How Was This Tested?

  • Local run
  • Unit tests
  • Integration tests

Notes

Validation performed by:

  • Starting GitMesh locally
  • Verifying inbound route registration
  • Sending POST requests to:
/api/forge/webhook/github

Results:

  • Route now resolves correctly
  • Previous HTTP 404 failure eliminated
  • Request successfully reaches webhook handler
  • Additional project-resolution issue identified during execution

CE & Security Check

  • Targets GitMesh CE only (no EE code)
  • No secrets or credentials committed

Screenshots / Demos

Before

POST /api/forge/webhook/github
→ 404 Not Found

After

POST /api/forge/webhook/github
→ Handler reached successfully

Follow-up Work

The following items remain outside the scope of this PR:

  • Project resolution fix (__gitmesh_project_id)
  • Inbound comment persistence
  • Pull request comment lookup fixes
  • GitHub review event mappings
  • Approval workflow integration
  • Outbound activity logging
  • Pull request merge API integration
  • Automated forge-sync test coverage

Checklist

  • Code follows project style
  • Self-reviewed
  • Documentation updated
  • Tests added (follow-up planned)

Signed-off-by: anurag gupta <job4anurag11@gmail.com>
This file was committed by mistake. It was created for personal assessment purposes only and is not required for this branch.

Signed-off-by: Anurag Gupta <job4anurag11@gmail.com>
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.

bug: Forge Integration Service (forge-sync) – Complete Bidirectional Synchronization, Webhook Reliability, and Outbound Action Execution

1 participant