Skip to content

fix(onboarding): forward GitHub App install callback to /api/github/callback#1

Merged
vishkulkarni2 merged 1 commit into
mainfrom
fix/onboarding-installation-link
Apr 23, 2026
Merged

fix(onboarding): forward GitHub App install callback to /api/github/callback#1
vishkulkarni2 merged 1 commit into
mainfrom
fix/onboarding-installation-link

Conversation

@vishkulkarni2
Copy link
Copy Markdown
Owner

Root Cause

The GitHub App's setup_url is configured as https://app.codesheriff.dev/onboarding. After a user installs the App, GitHub redirects to this URL with ?installation_id=NNN&setup_action=install. However, OnboardingPage was not reading searchParams, so it silently dropped the installation_id and the installation was never linked to the org — leaving the dashboard permanently empty.

The /api/github/callback route (added in 44208f7) was purpose-built to call POST /api/v1/orgs/current/github/link, sync repos, then redirect to /repos — but was never reachable because the setup_url points to /onboarding instead.

Fix

When ?installation_id is present in the onboarding page's query params, immediately redirect to /api/github/callback with those params. The callback handler takes care of the rest.

The webhook-based fallback (installation.created) remains in place but was unreliable due to org-matching heuristics.

Test Plan

  • Install CodeSheriff GitHub App on a test repo
  • Confirm redirect chain: GitHub → /onboarding?installation_id=…/api/github/callback?installation_id=…/repos
  • Confirm repos appear in dashboard within ~10 seconds
  • Confirm direct navigation to /onboarding (no params) still works normally

Residual Risk

If the setup_url is ever corrected to point directly at /api/github/callback, the forward here becomes a harmless no-op (the installation_id check is skipped on direct /onboarding loads).

🤖 Generated with Claude Code

The GitHub App setup_url is configured as /onboarding, so after install
GitHub redirects here with ?installation_id=&setup_action=install. The
page previously ignored these params, so the installation was never linked
to the org and repos never appeared in the dashboard.

Now we detect the installation_id and redirect to /api/github/callback
which calls POST /api/v1/orgs/current/github/link, syncs repos, and
then redirects to /repos. No logic is duplicated — the callback route
already handles the full linking + sync flow correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

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

Project Deployment Actions Updated (UTC)
codesheriff Building Building Preview, Comment Apr 23, 2026 5:20am

Request Review

@vishkulkarni2 vishkulkarni2 merged commit 7dee044 into main Apr 23, 2026
1 of 4 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

Development

Successfully merging this pull request may close these issues.

1 participant