fix: point the T3 Code URL handler at the wrapper #5

Merged
marti merged 1 commit from feature/t3code-url-handler into main 2026-10-19 14:14:23 +02:00
Owner

Problem

T3 Code installed through this flake cannot sign in to T3 Connect on Linux.

Sign-in runs Clerk OAuth in the system browser, which hands control back through a t3code:// callback. At startup the app registers itself as that handler by writing ~/.local/share/applications/com.t3tools.T3Code.desktop with Exec=$APPIMAGE or process.execPath. Outside an AppImage, process.execPath is the bare electron-unwrapped binary without the app directory (the t3code-desktop wrapper adds that), so the callback starts an empty electron and the pending sign-in never completes.

Fix

Override t3code-unwrapped with an extra postPatch that makes both writers (DesktopPreReadyPlatform.ts, DesktopLinuxUrlHandler.ts) use "t3code-desktop", resolved from PATH like upstream's own desktop file. That picks up the Home Manager wrapper with the provider PATH. --replace-fail breaks the build if upstream moves the lines.

Setting APPIMAGE in the wrapper was ruled out: electron-updater would then treat the store path as an AppImage to replace.

Notes

  • T3 Code now builds from source locally; the numtide cache does not have the patched derivation.
  • Worth reporting upstream to numtide/llm-agents.nix, which already patches a related isPackaged issue (#9182).

Testing

  • nix flake check passes.
  • Built the patched desktop output; the bundled main.cjs has execTarget: "t3code-desktop" at both writers.
  • Not yet tested: an actual T3 Connect sign-in after switching to the build.

🤖 Generated with Claude Code

## Problem T3 Code installed through this flake cannot sign in to T3 Connect on Linux. Sign-in runs Clerk OAuth in the system browser, which hands control back through a `t3code://` callback. At startup the app registers itself as that handler by writing `~/.local/share/applications/com.t3tools.T3Code.desktop` with `Exec=$APPIMAGE` or `process.execPath`. Outside an AppImage, `process.execPath` is the bare `electron-unwrapped` binary without the app directory (the `t3code-desktop` wrapper adds that), so the callback starts an empty electron and the pending sign-in never completes. ## Fix Override `t3code-unwrapped` with an extra `postPatch` that makes both writers (`DesktopPreReadyPlatform.ts`, `DesktopLinuxUrlHandler.ts`) use `"t3code-desktop"`, resolved from PATH like upstream's own desktop file. That picks up the Home Manager wrapper with the provider PATH. `--replace-fail` breaks the build if upstream moves the lines. Setting `APPIMAGE` in the wrapper was ruled out: electron-updater would then treat the store path as an AppImage to replace. ## Notes - T3 Code now builds from source locally; the numtide cache does not have the patched derivation. - Worth reporting upstream to numtide/llm-agents.nix, which already patches a related `isPackaged` issue (#9182). ## Testing - `nix flake check` passes. - Built the patched desktop output; the bundled `main.cjs` has `execTarget: "t3code-desktop"` at both writers. - Not yet tested: an actual T3 Connect sign-in after switching to the build. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On Linux T3 Code registers itself as the t3code:// handler with a desktop
entry whose Exec is $APPIMAGE or process.execPath. Outside an AppImage that
is the bare electron binary without the app directory, so the T3 Connect
sign-in callback opened an empty electron and never reached the app.

Patch both writers to run t3code-desktop from PATH, as upstream's own
desktop file does. --replace-fail breaks the build if upstream moves them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
marti merged commit 56241077cc into main 2026-10-19 14:14:23 +02:00
marti deleted branch feature/t3code-url-handler 2026-10-19 14:14:25 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marti/agent-env!5
No description provided.