/create_plan @thoughts/shared/research/2026-04-09-github-callback-404-routing.md
Rate quality
Private research annotation
Sign in to add a private research label or note.
- User
/create_plan @thoughts/shared/research/2026-04-09-github-callback-404-routing.md
- User
create_plan /create_plan @thoughts/shared/research/2026-04-09-github-callback-404-routing.md
Assistant· claude-opus-4-6
I've read the research document. The core issue is clear: the GitHub callback URL
/api/connect/github/callbackhits Clerk middleware auth before the rewrite to platform can fire. If the popup lacks a valid session, it gets a 307 redirect to/sign-ininstead of reaching the platform.Let me research the current codebase state to design the fix.
Assistant· claude-opus-4-6
Research complete. Here's my understanding of the problem and proposed fix:
Root Cause:
/api/connect/*is missing from theisPublicRoutematcher inapps/app/src/proxy.ts. Clerk middleware intercepts the callback before the Next.js rewrite to platform can fire. If the popup's Clerk session cookie is absent or expired after the GitHub redirect, the user gets a 307 to/sign-in(which manifests as the observed 404 in the popup context).Why this is safe to fix: The platform callback route (
processOAuthCallback) performs zero Clerk auth. Its entire security model is thenanoidstate token — ~125 bits entropy, single-use via atomic Redis , 10-minute TTL, with / embedded at authorize-time by a service-token-authenticated tRPC procedure. Making the callback public in app middleware changes nothing about security — the platform already runs no auth on this route.- User
yes all good
Assistant· claude-opus-4-6
Now let me write the plan.
Assistant· claude-opus-4-6
Plan created at
thoughts/shared/plans/2026-04-10-fix-github-callback-middleware-auth.md.Summary: One-line fix — add
"/api/connect(.*)"toisPublicRouteinapps/app/src/proxy.ts:28. This lets OAuth callbacks bypass Clerk middleware and reach the platform rewrite, where the state token provides all necessary security. Zero security impact since the platform already runs no auth on this route.Please review — are the phases, success criteria, and scope correct? Any adjustments needed before implementation?