Skip to content

fix(desktop): forward bundled-client API requests to the local backend - #15

Merged
camie-ace merged 1 commit into
mainfrom
codex/fix-desktop-github-login-405
Sep 23, 2026
Merged

camie-ace merged 1 commit into
mainfrom
codex/fix-desktop-github-login-405

Conversation

@camie-ace

Copy link
Copy Markdown
Owner

Desktop GitHub sign-in fails with "Failed to start GitHub login (405)" on nightly builds.

Cause

KamiCode's desktop user auth sends /api/user/* requests same-origin through t3code://app, so Electron's main-process cookie jar holds the user session. Upstream pingdotgg#9194 changed packaged builds to serve t3code://app from bundled assets (serveDesktopAsset), which answers every non-GET request with 405 and never reaches the backend. POST /api/user/auth/github/desktop/start was hitting that file server.

Confirmed on an installed 0.1.10-nightly.20260915.632: a direct POST to the local backend returns 401 (the route exists), and the backend trace shows no request from the app's click.

Fix

  • ElectronProtocol gains setLocalBackendOrigin. In bundled-asset mode, /api/* is forwarded to the local backend with the same proxy dev mode uses. It returns a JSON 503 while no local backend is running. All other paths are still served from disk.
  • DesktopApp sets the origin once the backend endpoint is resolved.
  • New test covers the 503 before the backend is known, POST forwarding with credentials, and static serving still working.

Verification

  • vp test run apps/desktop/src/electron/ElectronProtocol.test.ts: 9/9 pass
  • vp fmt --check and vp lint on touched files; desktop tsc --noEmit has no errors

🤖 Generated with Claude Code

Packaged builds serve t3code://app from bundled assets, and that handler
answered every non-GET request with 405. Desktop GitHub login posts to
/api/user/auth/github/desktop/start through that origin, so sign-in failed
with "Failed to start GitHub login (405)".

Forward /api/* to the local backend once its origin is known, and return a
JSON 503 while no local backend is running.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M labels Sep 23, 2026
@camie-ace
camie-ace merged commit 58488e4 into main Sep 23, 2026
7 of 16 checks passed
@camie-ace
camie-ace deleted the codex/fix-desktop-github-login-405 branch September 23, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant