mirror of
https://github.com/okieselbach/AutopilotMonitor.git
synced 2026-10-25 13:10:13 +00:00
f783d609cf
GitHub Copilot / VS Code stalled forever on "Waiting for server to respond to initialize". Root cause is NOT initialize handling (the server answers it correctly) but the per-client redirect_uri binding at /oauth/authorize: it used an exact-string includes() match, while VS Code registers the loopback URI without a trailing slash (http://127.0.0.1:PORT) and then authorizes with the URL-normalized form (http://127.0.0.1:PORT/). The exact match returned false -> 400 invalid_request at /authorize -> no code -> no token -> initialize never authorized -> perpetual wait. Reproduced live against the deployed server. Replace the exact match with canonicalizeRedirectUri + redirectUriMatches: - parse + re-serialize so a trailing-slash / serialization difference compares equal; - drop the port for loopback hosts, per RFC 8252 section 7.3 (the AS must allow any port for loopback redirect URIs) — this also covers the ephemeral-port-per-run behaviour of native clients. The host allowlist already permits any loopback port, so this grants no new reach. Non-loopback hosts (e.g. vscode.dev) keep full host+port+path matching. Applied at both /oauth/authorize and /oauth/callback. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>