Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat: Hosted Frontend, Tailscale Integration & SSH Lancher #2361

Mergedjuliusmarmingemerged 76 commits intomain fromrefs/pull/2361/headmerged by juliusmarminge View on GitHub

juliusmarmingecommented

Note

High Risk High risk because it adds new remote-access surfaces (SSH launch/prompt IPC, Tailscale Serve lifecycle, advertised endpoint selection) and changes server/desktop config and runtime behavior, which can affect connectivity and security-sensitive auth flows.

Overview Adds a first-class remote endpoint discovery model (AdvertisedEndpoint) and updates docs to clarify hosted pairing constraints (browser HTTPS/WSS compatibility, tokens in URL hash) and endpoint/provider selection.

Extends the desktop app to surface advertised endpoints (core loopback/LAN + user HTTPS + Tailscale add-on), persist Tailscale Serve settings, expose new IPC for endpoint listing and SSH environment management (host discovery, create/disconnect tunnelled environments, password prompt/timeout handling), and persist desktopSsh metadata on saved environments.

Updates the server to support --tailscale-serve/env/bootstrap config, enabling/disabling Tailscale Serve on startup/shutdown, improves WS error logging/mapping for orchestration snapshots, and adjusts server-config push payloads (keybindings now included). The web UI adds hosted /pair auto-pairing, reconnect/version-mismatch composer banners that block sends/actions when the active environment is unavailable, and small resiliency tweaks (favicon URL errors, mobile run-context lock rendering, connection toast labeling).

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 86e1b678e7dca7fb616eec30fdce888add47e52a. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add hosted frontend, Tailscale Serve integration, and SSH-backed environment management to desktop and web

  • Introduces a hosted static web app mode where the frontend can run without a paired backend, with a /pair route that auto-submits one-time pairing tokens from the URL via a new HostedPairingRouteSurface component
  • Adds Tailscale Serve support across the server (--tailscale-serve CLI flag, env vars) and desktop (settings toggle, port config, app relaunch on change), enabling HTTPS access via MagicDNS and advertising Tailscale endpoints
  • Introduces new @t3tools/ssh and @t3tools/tailscale packages implementing SSH tunnel orchestration (port forwarding, remote server launch, password prompts, bearer session management) and Tailscale status/serve control
  • Rewrites ConnectionsSettings to support adding environments via SSH discovery or manual entry, connecting/disconnecting saved environments, selecting a default advertised endpoint, and generating hosted-app pairing links
  • Adds ComposerBannerStack to ChatView showing disconnected-environment and version-mismatch banners; sending and checkpoint revert are blocked while the active environment is unavailable
  • Adds SshPasswordPromptDialog to the desktop web UI, queuing SSH password requests with expiration countdowns and forwarding responses via the desktop bridge
  • Risk: relaunching the desktop app is required to apply Tailscale Serve changes; app relaunch disposes SSH environment resources which may interrupt active sessions
Macroscope summarized 86e1b67.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro

      Run ID: 352672e0-c017-487c-8367-80125cfaf3fd

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `t3code/hosted-pairing-ui`

      Comment `@coderabbitai help` to get the list of available commands and usage tips.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Hosted pairing URL fallback to desktop URL is unreachable
        • Added isHostedPairingCompatible check so resolveHostedPairingUrl returns null for non-HTTPS endpoints, allowing the ?? operator to correctly fall through to resolveDesktopPairingUrl for HTTP LAN backends.

      Create PR

      Or push these changes by commenting:

      @cursor push 428913d5d5
      Preview (pingdotgg/t3code@428913d5d5)
      diff --git a/apps/web/src/components/settings/ConnectionsSettings.tsx b/apps/web/src/components/settings/ConnectionsSettings.tsx
      --- a/apps/web/src/components/settings/ConnectionsSettings.tsx
      +++ b/apps/web/src/components/settings/ConnectionsSettings.tsx
      @@ -250,7 +250,18 @@
         return setPairingTokenOnUrl(url, credential).toString();
       }
       
      -function resolveHostedPairingUrl(endpointUrl: string, credential: string): string {
      +function isHostedPairingCompatible(endpointUrl: string): boolean {
      +  try {
      +    return new URL(endpointUrl).protocol === "https:";
      +  } catch {
      +    return false;
      +  }
      +}
      +
      +function resolveHostedPairingUrl(endpointUrl: string, credential: string): string | null {
      +  if (!isHostedPairingCompatible(endpointUrl)) {
      +    return null;
      +  }
         return buildHostedPairingUrl({
           host: endpointUrl,
           token: credential,
      You can send follow-ups to the cloud agent here.
    4. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs human review

      Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    5. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      There are 2 total unresolved issues (including 1 from previous review).

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Cached no-RPC LocalApi causes failures in newly-accessible routes
        • Moved the fire-and-forget server.updateSettings RPC call inside the existing if (currentServerConfig) guard so it is only attempted when a server backend is actually connected, preventing unhandled rejections in hosted-static mode.

      Create PR

      Or push these changes by commenting:

      @cursor push f485d6b4ba
      Preview (pingdotgg/t3code@f485d6b4ba)
      diff --git a/apps/web/src/hooks/useSettings.ts b/apps/web/src/hooks/useSettings.ts
      --- a/apps/web/src/hooks/useSettings.ts
      +++ b/apps/web/src/hooks/useSettings.ts
      @@ -165,9 +165,9 @@
             const currentServerConfig = getServerConfig();
             if (currentServerConfig) {
               applySettingsUpdated(applyServerSettingsPatch(currentServerConfig.settings, serverPatch));
      +        // Fire-and-forget RPC — push will reconcile on success
      +        void ensureLocalApi().server.updateSettings(serverPatch);
             }
      -      // Fire-and-forget RPC — push will reconcile on success
      -      void ensureLocalApi().server.updateSettings(serverPatch);
           }
       
           if (Object.keys(clientPatch).length > 0) {
      You can send follow-ups to the cloud agent here.
    6. Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Catch-all silently degrades desktop/self-hosted on transient failures
        • Narrowed the catch block to only enter hosted-static mode when the primary environment target source is 'window-origin' (the hosted app fallback), re-throwing errors for 'desktop-managed' and 'configured' targets so the error page is shown.

      Create PR

      Or push these changes by commenting:

      @cursor push 519c3e126d
      Preview (pingdotgg/t3code@519c3e126d)
      diff --git a/apps/web/src/environments/primary/index.ts b/apps/web/src/environments/primary/index.ts
      --- a/apps/web/src/environments/primary/index.ts
      +++ b/apps/web/src/environments/primary/index.ts
      @@ -32,4 +32,8 @@
         __resetServerAuthBootstrapForTests,
       } from "./auth";
       
      -export { resolvePrimaryEnvironmentHttpUrl, isLoopbackHostname } from "./target";
      +export {
      +  resolvePrimaryEnvironmentHttpUrl,
      +  isLoopbackHostname,
      +  readPrimaryEnvironmentTarget,
      +} from "./target";
      
      diff --git a/apps/web/src/routes/__root.tsx b/apps/web/src/routes/__root.tsx
      --- a/apps/web/src/routes/__root.tsx
      +++ b/apps/web/src/routes/__root.tsx
      @@ -55,6 +55,7 @@
       import {
         ensurePrimaryEnvironmentReady,
         getPrimaryKnownEnvironment,
      +  readPrimaryEnvironmentTarget,
         resolveInitialServerAuthGateState,
         updatePrimaryEnvironmentDescriptor,
       } from "../environments/primary";
      @@ -81,7 +82,8 @@
               authGateState,
             };
           } catch (error) {
      -      if (location.pathname === "/pair") {
      +      const primaryTarget = readPrimaryEnvironmentTarget();
      +      if (location.pathname === "/pair" || primaryTarget?.source !== "window-origin") {
               throw error;
             }
      You can send follow-ups to the cloud agent here.
    7. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: "Try again" button regresses paired state to error
        • Wrapped the 'Try again' button in a status !== "paired" conditional so it is hidden after successful pairing, preventing re-invocation of submitHostedPairingRequest which would throw on the already-connected environment.

      Create PR

      Or push these changes by commenting:

      @cursor push 9d19673665
      Preview (pingdotgg/t3code@9d19673665)
      diff --git a/apps/web/src/components/auth/PairingRouteSurface.tsx b/apps/web/src/components/auth/PairingRouteSurface.tsx
      --- a/apps/web/src/components/auth/PairingRouteSurface.tsx
      +++ b/apps/web/src/components/auth/PairingRouteSurface.tsx
      @@ -240,13 +240,15 @@
               ) : null}
       
               <div className="mt-6 flex flex-wrap gap-2">
      -          <Button
      -            disabled={status === "pairing"}
      -            size="sm"
      -            onClick={() => void submitHostedPairingRequest()}
      -          >
      -            {status === "pairing" ? "Pairing..." : "Try again"}
      -          </Button>
      +          {status !== "paired" ? (
      +            <Button
      +              disabled={status === "pairing"}
      +              size="sm"
      +              onClick={() => void submitHostedPairingRequest()}
      +            >
      +              {status === "pairing" ? "Pairing..." : "Try again"}
      +            </Button>
      +          ) : null}
                 {status === "paired" ? (
                   <Button size="sm" variant="outline" onClick={() => (window.location.href = "/")}>
                     Open app
      You can send follow-ups to the cloud agent here.
    8. juliusmarminge changed the title

    9. Cursor Bugbot has reviewed your changes and found 2 potential issues.

      Autofix Details

      Bugbot Autofix prepared fixes for both issues found in the latest run.

      • ✅ Fixed: Password dialog lacks Enter key form submission
        • Wrapped the dialog content in a [removed] element with an onSubmit handler and changed the Continue button to type="submit", enabling standard Enter-to-submit behavior.
      • ✅ Fixed: Custom HTTPS endpoints bypass mixed-content compatibility check
        • Removed the hardcoded hostedHttpsCompatibility: "compatible" override so that classifyHostedHttpsCompatibility runs automatically and correctly detects http:// URLs as "mixed-content-blocked".

      Create PR

      Or push these changes by commenting:

      @cursor push 4dd2f66636
      Preview (pingdotgg/t3code@4dd2f66636)
      diff --git a/apps/desktop/src/serverExposure.ts b/apps/desktop/src/serverExposure.ts
      --- a/apps/desktop/src/serverExposure.ts
      +++ b/apps/desktop/src/serverExposure.ts
      @@ -162,7 +162,6 @@
               label: "Custom HTTPS",
               httpBaseUrl: customEndpointUrl,
               reachability: "public",
      -        hostedHttpsCompatibility: "compatible",
               status: "unknown",
               description: "User-configured HTTPS endpoint for this desktop backend.",
             }),
      
      diff --git a/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx b/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx
      --- a/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx
      +++ b/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx
      @@ -76,38 +76,43 @@
             }}
           >
             <DialogPopup className="max-w-md" showCloseButton={false}>
      -        <DialogHeader>
      -          <DialogTitle>SSH Password Required</DialogTitle>
      -          <DialogDescription>
      -            T3 needs your SSH password to connect to{" "}
      -            {target ? <code>{target}</code> : "the remote host"}. The password is passed to the
      -            local SSH process for this connection attempt and is not saved by T3 Code.
      -          </DialogDescription>
      -        </DialogHeader>
      -        <DialogPanel className="space-y-3" scrollFade={false}>
      -          <div className="space-y-2">
      -            <p className="text-sm font-medium text-foreground">{currentRequest?.prompt}</p>
      -            <Input
      -              ref={inputRef}
      -              autoComplete="current-password"
      -              name="ssh-password"
      -              type="password"
      -              value={password}
      -              onChange={(event) => setPassword(event.target.value)}
      -            />
      -          </div>
      -          <p className="text-sm text-muted-foreground">
      -            Use SSH keys to avoid repeated password prompts on new SSH sessions.
      -          </p>
      -        </DialogPanel>
      -        <DialogFooter>
      -          <Button variant="outline" onClick={() => void respond(null)}>
      -            Cancel
      -          </Button>
      -          <Button onClick={() => void respond(password)} type="button">
      -            Continue
      -          </Button>
      -        </DialogFooter>
      +        <form
      +          onSubmit={(event) => {
      +            event.preventDefault();
      +            void respond(password);
      +          }}
      +        >
      +          <DialogHeader>
      +            <DialogTitle>SSH Password Required</DialogTitle>
      +            <DialogDescription>
      +              T3 needs your SSH password to connect to{" "}
      +              {target ? <code>{target}</code> : "the remote host"}. The password is passed to the
      +              local SSH process for this connection attempt and is not saved by T3 Code.
      +            </DialogDescription>
      +          </DialogHeader>
      +          <DialogPanel className="space-y-3" scrollFade={false}>
      +            <div className="space-y-2">
      +              <p className="text-sm font-medium text-foreground">{currentRequest?.prompt}</p>
      +              <Input
      +                ref={inputRef}
      +                autoComplete="current-password"
      +                name="ssh-password"
      +                type="password"
      +                value={password}
      +                onChange={(event) => setPassword(event.target.value)}
      +              />
      +            </div>
      +            <p className="text-sm text-muted-foreground">
      +              Use SSH keys to avoid repeated password prompts on new SSH sessions.
      +            </p>
      +          </DialogPanel>
      +          <DialogFooter>
      +            <Button type="button" variant="outline" onClick={() => void respond(null)}>
      +              Cancel
      +            </Button>
      +            <Button type="submit">Continue</Button>
      +          </DialogFooter>
      +        </form>
             </DialogPopup>
           </Dialog>
         );
      You can send follow-ups to the cloud agent here.
    10. Cursor Bugbot has reviewed your changes and found 3 potential issues.

      There are 5 total unresolved issues (including 2 from previous reviews).

      Autofix Details

      Bugbot Autofix prepared fixes for all 3 issues found in the latest run.

      • ✅ Fixed: Hosted pairing token stripped before retry can re-read URL
        • Added a tokenSubmittedRef that tracks whether the one-time token was already sent to the server; retries now show a distinct message asking the user to request a new pairing link instead of silently reusing a consumed token.
      • ✅ Fixed: Password prompt queue corrupted by rapid double-click
        • Added an isResponding state guard that prevents concurrent invocations of respond and disables both buttons while the IPC call is in-flight, preventing double-click from dequeuing a prompt without resolving it.
      • ✅ Fixed: Redundant setDesktopTailscaleServePreference call in apply path
        • Refactored applyDesktopTailscaleServeEnabled to accept the already-resolved DesktopSettings directly from the IPC handler, eliminating the redundant re-derivation.

      Create PR

      Or push these changes by commenting:

      @cursor push 614ff021d2
      Preview (pingdotgg/t3code@614ff021d2)
      diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts
      --- a/apps/desktop/src/main.ts
      +++ b/apps/desktop/src/main.ts
      @@ -402,13 +402,14 @@
         return getDesktopServerExposureState();
       }
       
      -async function applyDesktopTailscaleServeEnabled(input: {
      -  readonly enabled: boolean;
      -  readonly port?: number;
      -}): Promise<DesktopServerExposureState> {
      -  desktopSettings = setDesktopTailscaleServePreference(desktopSettings, input);
      +async function applyDesktopTailscaleServeEnabled(
      +  resolvedSettings: typeof desktopSettings,
      +): Promise<DesktopServerExposureState> {
      +  desktopSettings = resolvedSettings;
         writeDesktopSettings(DESKTOP_SETTINGS_PATH, desktopSettings);
      -  relaunchDesktopApp(input.enabled ? "tailscale-serve-enabled" : "tailscale-serve-disabled");
      +  relaunchDesktopApp(
      +    desktopSettings.tailscaleServeEnabled ? "tailscale-serve-enabled" : "tailscale-serve-disabled",
      +  );
         return getDesktopServerExposureState();
       }
       
      @@ -1751,10 +1752,7 @@
           if (nextSettings === desktopSettings) {
             return getDesktopServerExposureState();
           }
      -    return applyDesktopTailscaleServeEnabled({
      -      enabled: input.enabled,
      -      port: nextSettings.tailscaleServePort,
      -    });
      +    return applyDesktopTailscaleServeEnabled(nextSettings);
         });
       
         ipcMain.removeHandler(GET_ADVERTISED_ENDPOINTS_CHANNEL);
      
      diff --git a/apps/web/src/components/auth/PairingRouteSurface.tsx b/apps/web/src/components/auth/PairingRouteSurface.tsx
      --- a/apps/web/src/components/auth/PairingRouteSurface.tsx
      +++ b/apps/web/src/components/auth/PairingRouteSurface.tsx
      @@ -166,6 +166,7 @@
         const [status, setStatus] = useState<"pairing" | "paired" | "error">("pairing");
         const [message, setMessage] = useState("Connecting to this backend.");
         const submitAttemptedRef = useRef(false);
      +  const tokenSubmittedRef = useRef(false);
       
         const submitHostedPairingRequest = useCallback(async () => {
           const request = hostedPairingRequestRef.current;
      @@ -176,9 +177,18 @@
             return;
           }
       
      +    if (tokenSubmittedRef.current) {
      +      setStatus("error");
      +      setMessage(
      +        "The pairing token may have already been used. Please request a new pairing link.",
      +      );
      +      return;
      +    }
      +
           setStatus("pairing");
           setMessage("Connecting to this backend.");
       
      +    tokenSubmittedRef.current = true;
           try {
             const record = await addSavedEnvironment({
               label: request.label,
      
      diff --git a/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx b/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx
      --- a/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx
      +++ b/apps/web/src/components/desktop/SshPasswordPromptDialog.tsx
      @@ -20,6 +20,7 @@
       export function SshPasswordPromptDialog() {
         const [queue, setQueue] = useState<readonly DesktopSshPasswordPromptRequest[]>([]);
         const [password, setPassword] = useState("");
      +  const [isResponding, setIsResponding] = useState(false);
         const currentRequest = queue[0] ?? null;
         const inputRef = useRef<HTMLInputElement | null>(null);
       
      @@ -50,17 +51,20 @@
         }, [currentRequest]);
       
         const respond = async (nextPassword: string | null) => {
      -    if (!currentRequest) {
      +    if (!currentRequest || isResponding) {
             return;
           }
       
           const requestId = currentRequest.requestId;
      +    setIsResponding(true);
           setQueue((currentQueue) => currentQueue.slice(1));
           setPassword("");
           try {
             await window.desktopBridge?.resolveSshPasswordPrompt(requestId, nextPassword);
           } catch (error) {
             console.error("Failed to resolve SSH password prompt.", error);
      +    } finally {
      +      setIsResponding(false);
           }
         };
       
      @@ -101,10 +105,10 @@
                 </p>
               </DialogPanel>
               <DialogFooter>
      -          <Button variant="outline" onClick={() => void respond(null)}>
      +          <Button disabled={isResponding} variant="outline" onClick={() => void respond(null)}>
                   Cancel
                 </Button>
      -          <Button onClick={() => void respond(password)} type="button">
      +          <Button disabled={isResponding} onClick={() => void respond(password)} type="button">
                   Continue
                 </Button>
               </DialogFooter>
      You can send follow-ups to the cloud agent here.
    11. Cursor Bugbot has reviewed your changes and found 2 potential issues.

      Autofix Details

      Bugbot Autofix prepared fixes for both issues found in the latest run.

      • ✅ Fixed: Retry button never renders after hosted pairing failure
        • Reset tokenSubmittedRef.current to false in the catch block so the 'Try again' button condition (!tokenSubmittedRef.current) evaluates to true after a failure.
      • ✅ Fixed: Unhandled URL parse error crashes endpoint resolution
        • Wrapped the new URL() call in isHttpsEndpointUrl with a try-catch that returns false for malformed URLs, preventing a single bad entry from crashing the entire endpoint resolution.

      Create PR

      Or push these changes by commenting:

      @cursor push ac015aaec3
      Preview (pingdotgg/t3code@ac015aaec3)
      diff --git a/apps/desktop/src/serverExposure.ts b/apps/desktop/src/serverExposure.ts
      --- a/apps/desktop/src/serverExposure.ts
      +++ b/apps/desktop/src/serverExposure.ts
      @@ -50,7 +50,11 @@
         !address.startsWith("127.") && !address.startsWith("169.254.");
       
       function isHttpsEndpointUrl(value: string): boolean {
      -  return new URL(value).protocol === "https:";
      +  try {
      +    return new URL(value).protocol === "https:";
      +  } catch {
      +    return false;
      +  }
       }
       
       export function resolveLanAdvertisedHost(
      
      diff --git a/apps/web/src/components/auth/PairingRouteSurface.tsx b/apps/web/src/components/auth/PairingRouteSurface.tsx
      --- a/apps/web/src/components/auth/PairingRouteSurface.tsx
      +++ b/apps/web/src/components/auth/PairingRouteSurface.tsx
      @@ -196,6 +196,7 @@
             setStatus("paired");
             setMessage(`${record.label} is saved in this browser.`);
           } catch (error) {
      +      tokenSubmittedRef.current = false;
             setStatus("error");
             setMessage(
               `${errorMessageFromUnknown(error)} Request a new pairing link before trying again.`,
      You can send follow-ups to the cloud agent here.
    12. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Misleading "Custom HTTPS" label for non-HTTPS endpoints
        • Made the label and description conditional on isHttpsEndpointUrl: HTTPS URLs get "Custom HTTPS" / "HTTPS endpoint" text, while non-HTTPS URLs get "Custom endpoint" / generic description.

      Create PR

      Or push these changes by commenting:

      @cursor push 72d1449f64
      Preview (pingdotgg/t3code@72d1449f64)
      diff --git a/apps/desktop/src/serverExposure.test.ts b/apps/desktop/src/serverExposure.test.ts
      --- a/apps/desktop/src/serverExposure.test.ts
      +++ b/apps/desktop/src/serverExposure.test.ts
      @@ -171,7 +171,7 @@
             },
             {
               id: "manual:http://desktop.example.test:3773",
      -        label: "Custom HTTPS",
      +        label: "Custom endpoint",
               provider: {
                 id: "manual",
                 label: "Manual",
      @@ -187,7 +187,7 @@
               },
               source: "user",
               status: "unknown",
      -        description: "User-configured HTTPS endpoint for this desktop backend.",
      +        description: "User-configured endpoint for this desktop backend.",
             },
           ]);
         });
      
      diff --git a/apps/desktop/src/serverExposure.ts b/apps/desktop/src/serverExposure.ts
      --- a/apps/desktop/src/serverExposure.ts
      +++ b/apps/desktop/src/serverExposure.ts
      @@ -165,17 +165,18 @@
       
         for (const customEndpointUrl of input.customHttpsEndpointUrls ?? []) {
           try {
      +      const isHttps = isHttpsEndpointUrl(customEndpointUrl);
             endpoints.push(
               createManualEndpoint({
                 id: `manual:${customEndpointUrl}`,
      -          label: "Custom HTTPS",
      +          label: isHttps ? "Custom HTTPS" : "Custom endpoint",
                 httpBaseUrl: customEndpointUrl,
                 reachability: "public",
      -          ...(isHttpsEndpointUrl(customEndpointUrl)
      -            ? ({ hostedHttpsCompatibility: "compatible" } as const)
      -            : {}),
      +          ...(isHttps ? ({ hostedHttpsCompatibility: "compatible" } as const) : {}),
                 status: "unknown",
      -          description: "User-configured HTTPS endpoint for this desktop backend.",
      +          description: isHttps
      +            ? "User-configured HTTPS endpoint for this desktop backend."
      +            : "User-configured endpoint for this desktop backend.",
               }),
             );
           } catch {
      You can send follow-ups to the cloud agent here.
    13. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      There are 2 total unresolved issues (including 1 from previous review).

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Tailscale Serve uses config port before server binds
        • The tailscaleServeLayer now reads the actual bound port from HttpServer.address (matching the pattern used by runtimeStateLayer) instead of using config.port directly, so when port 0 is specified the real OS-assigned port is passed to ensureTailscaleServe.

      Create PR

      Or push these changes by commenting:

      @cursor push c90ddf7775
      Preview (pingdotgg/t3code@c90ddf7775)
      diff --git a/apps/server/src/server.ts b/apps/server/src/server.ts
      --- a/apps/server/src/server.ts
      +++ b/apps/server/src/server.ts
      @@ -309,17 +309,24 @@
           );
           const tailscaleServeLayer = config.tailscaleServeEnabled
             ? Layer.effectDiscard(
      -          ensureTailscaleServe({
      -            localPort: config.port,
      -            servePort: config.tailscaleServePort,
      -            localHost: "127.0.0.1",
      +          Effect.gen(function* () {
      +            const server = yield* HttpServer.HttpServer;
      +            const address = server.address;
      +            const localPort =
      +              typeof address !== "string" && "port" in address ? address.port : config.port;
      +            yield* ensureTailscaleServe({
      +              localPort,
      +              servePort: config.tailscaleServePort,
      +              localHost: "127.0.0.1",
      +            }).pipe(
      +              Effect.tap(() =>
      +                Effect.logInfo("Tailscale Serve configured", {
      +                  localPort,
      +                  servePort: config.tailscaleServePort,
      +                }),
      +              ),
      +            );
                 }).pipe(
      -            Effect.tap(() =>
      -              Effect.logInfo("Tailscale Serve configured", {
      -                localPort: config.port,
      -                servePort: config.tailscaleServePort,
      -              }),
      -            ),
                   Effect.catch((cause) =>
                     Effect.logWarning("Failed to configure Tailscale Serve", {
                       cause,
      You can send follow-ups to the cloud agent here.
    14. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      There are 3 total unresolved issues (including 2 from previous reviews).

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Token stripped before reading hosted pairing request
        • Cached the result of readHostedPairingRequest() in a module-level variable so that remounts of HostedPairingRouteSurface read the originally-captured token instead of re-reading the already-stripped URL.

      Create PR

      Or push these changes by commenting:

      @cursor push f4b4a82b5a
      Preview (pingdotgg/t3code@f4b4a82b5a)
      diff --git a/apps/web/src/components/auth/PairingRouteSurface.tsx b/apps/web/src/components/auth/PairingRouteSurface.tsx
      --- a/apps/web/src/components/auth/PairingRouteSurface.tsx
      +++ b/apps/web/src/components/auth/PairingRouteSurface.tsx
      @@ -161,8 +161,16 @@
         );
       }
       
      +let cachedHostedPairingRequest: ReturnType<typeof readHostedPairingRequest> | undefined;
      +function readHostedPairingRequestOnce() {
      +  if (cachedHostedPairingRequest === undefined) {
      +    cachedHostedPairingRequest = readHostedPairingRequest();
      +  }
      +  return cachedHostedPairingRequest;
      +}
      +
       export function HostedPairingRouteSurface() {
      -  const hostedPairingRequestRef = useRef(readHostedPairingRequest());
      +  const hostedPairingRequestRef = useRef(readHostedPairingRequestOnce());
         const [status, setStatus] = useState<"pairing" | "paired" | "error">("pairing");
         const [message, setMessage] = useState("Connecting to this backend.");
         const submitAttemptedRef = useRef(false);
      You can send follow-ups to the cloud agent here.
    15. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      There are 4 total unresolved issues (including 3 from previous reviews).

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Windows askpass CMD references wrong PowerShell filename
        • Updated askpass-windows.cmd to invoke askpass-windows.ps1 instead of the nonexistent ssh-askpass.ps1.

      Create PR

      Or push these changes by commenting:

      @cursor push 2befcb1e74
      Preview (pingdotgg/t3code@2befcb1e74)
      diff --git a/apps/desktop/src/sshScripts/askpass-windows.cmd b/apps/desktop/src/sshScripts/askpass-windows.cmd
      --- a/apps/desktop/src/sshScripts/askpass-windows.cmd
      +++ b/apps/desktop/src/sshScripts/askpass-windows.cmd
      @@ -1,2 +1,2 @@
       @echo off
      -powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0ssh-askpass.ps1" %*
      +powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0askpass-windows.ps1" %*
      You can send follow-ups to the cloud agent here.
    16. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      There are 4 total unresolved issues (including 3 from previous reviews).

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Hardcoded developer-specific path as fallback value
        • Changed the fallback value from a developer-specific absolute path to an empty string so the guard correctly falls through to the production CLI resolution path when the env var is unset.

      Create PR

      Or push these changes by commenting:

      @cursor push eb3bd611e5
      Preview (pingdotgg/t3code@eb3bd611e5)
      diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts
      --- a/apps/desktop/src/main.ts
      +++ b/apps/desktop/src/main.ts
      @@ -124,8 +124,7 @@
       // for a built server entry, for example:
       // "/Users/julius/Development/Work/codething-mvp/apps/server/dist/bin.mjs"
       const DEV_REMOTE_T3_SERVER_ENTRY_PATH =
      -  process.env.T3CODE_DEV_REMOTE_T3_SERVER_ENTRY_PATH?.trim() ??
      -  "/Users/julius/Developer/t3code/apps/server/dist/bin.mjs";
      +  process.env.T3CODE_DEV_REMOTE_T3_SERVER_ENTRY_PATH?.trim() ?? "";
       const desktopAppBranding: DesktopAppBranding = resolveDesktopAppBranding({
         isDevelopment,
         appVersion: app.getVersion(),
      You can send follow-ups to the cloud agent here.
    17. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/7c52db2710ace12bda15bfd028fdfcb23cce32a7/apps/web/src/components/ChatView.tsx#L3069

      onImplementPlanInNewThread does not check activeEnvironmentUnavailable before dispatching commands. When the environment is disconnected but the API object is still stale (not yet cleaned up), readEnvironmentApi returns a non-undefined API, so the !api guard passes and the function attempts to dispatch thread.create and thread.turn.start to an unavailable environment. This will likely fail with confusing errors or hang. Consider adding the same activeEnvironmentUnavailable guard that was added to onSend.

      No longer relevant as of 953ce2c26610c55c779c2d473d19a3877edafc75

    18. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Composer disabled during approval/input states blocks needed interaction
        • Changed the disabled condition to only apply environmentUnavailable when activePendingProgress is null, allowing users to type custom answers for pending user inputs even during temporary disconnects.

      Create PR

      Or push these changes by commenting:

      @cursor push fb722be077
      Preview (pingdotgg/t3code@fb722be077)
      diff --git a/apps/web/src/components/chat/ChatComposer.tsx b/apps/web/src/components/chat/ChatComposer.tsx
      --- a/apps/web/src/components/chat/ChatComposer.tsx
      +++ b/apps/web/src/components/chat/ChatComposer.tsx
      @@ -1989,7 +1989,9 @@
                                   : "Ask anything, @tag files/folders, or use / to show available commands"
                       }
                       disabled={
      -                  isConnecting || isComposerApprovalState || environmentUnavailable !== null
      +                  isConnecting ||
      +                  isComposerApprovalState ||
      +                  (environmentUnavailable !== null && activePendingProgress === null)
                       }
                     />
                   </div>
      You can send follow-ups to the cloud agent here.
    19. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      There are 2 total unresolved issues (including 1 from previous review).

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Revert check unreachable when environment is disconnected
        • Moved the activeEnvironmentUnavailable check before the readEnvironmentApi call so the informative error message is shown instead of a silent early return when the environment is disconnected.

      Create PR

      Or push these changes by commenting:

      @cursor push fdc0ee45ec
      Preview (pingdotgg/t3code@fdc0ee45ec)
      diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
      --- a/apps/web/src/components/ChatView.tsx
      +++ b/apps/web/src/components/ChatView.tsx
      @@ -2417,9 +2417,7 @@
       
         const onRevertToTurnCount = useCallback(
           async (turnCount: number) => {
      -      const api = readEnvironmentApi(environmentId);
      -      const localApi = readLocalApi();
      -      if (!api || !localApi || !activeThread || isRevertingCheckpoint) return;
      +      if (!activeThread || isRevertingCheckpoint) return;
       
             if (activeEnvironmentUnavailable && activeEnvironmentUnavailableLabel) {
               setThreadError(
      @@ -2428,6 +2426,10 @@
               );
               return;
             }
      +
      +      const api = readEnvironmentApi(environmentId);
      +      const localApi = readLocalApi();
      +      if (!api || !localApi) return;
             if (phase === "running" || isSendBusy || isConnecting) {
               setThreadError(activeThread.id, "Interrupt the current turn before reverting checkpoints.");
               return;
      You can send follow-ups to the cloud agent here.
    20. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      There are 3 total unresolved issues (including 2 from previous reviews).

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Hardcoded APP_VERSION bypasses dynamic build version
        • Restored the original dynamic expression import.meta.env.APP_VERSION || "0.0.0" replacing the accidentally committed hardcoded "0.0.20" value.

      Create PR

      Or push these changes by commenting:

      @cursor push 92d33af30a
      Preview (pingdotgg/t3code@92d33af30a)
      diff --git a/apps/web/src/branding.ts b/apps/web/src/branding.ts
      --- a/apps/web/src/branding.ts
      +++ b/apps/web/src/branding.ts
      @@ -15,4 +15,4 @@
         injectedDesktopAppBranding?.stageLabel ?? (import.meta.env.DEV ? "Dev" : "Alpha");
       export const APP_DISPLAY_NAME =
         injectedDesktopAppBranding?.displayName ?? `${APP_BASE_NAME} (${APP_STAGE_LABEL})`;
      -export const APP_VERSION = "0.0.20"; // import.meta.env.APP_VERSION || "0.0.0";
      +export const APP_VERSION = import.meta.env.APP_VERSION || "0.0.0";
      You can send follow-ups to the cloud agent here.
    21. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      There are 2 total unresolved issues (including 1 from previous review).

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Hosted pairing shows misleading initial state flash
        • Initialized status and message state using lazy initializers that derive from the ref value, so a null hosted pairing request immediately renders the error state without a flash.

      Create PR

      Or push these changes by commenting:

      @cursor push 70a1b595ea
      Preview (pingdotgg/t3code@70a1b595ea)
      diff --git a/apps/web/src/components/auth/PairingRouteSurface.tsx b/apps/web/src/components/auth/PairingRouteSurface.tsx
      --- a/apps/web/src/components/auth/PairingRouteSurface.tsx
      +++ b/apps/web/src/components/auth/PairingRouteSurface.tsx
      @@ -163,8 +163,14 @@
       
       export function HostedPairingRouteSurface() {
         const hostedPairingRequestRef = useRef(readHostedPairingRequest());
      -  const [status, setStatus] = useState<"pairing" | "paired" | "error">("pairing");
      -  const [message, setMessage] = useState("Connecting to this backend.");
      +  const [status, setStatus] = useState<"pairing" | "paired" | "error">(() =>
      +    hostedPairingRequestRef.current ? "pairing" : "error",
      +  );
      +  const [message, setMessage] = useState(() =>
      +    hostedPairingRequestRef.current
      +      ? "Connecting to this backend."
      +      : "This pairing link is missing its backend host or token.",
      +  );
         const submitAttemptedRef = useRef(false);
         const tokenSubmittedRef = useRef(false);
      You can send follow-ups to the cloud agent here.
    22. Cursor Bugbot has reviewed your changes and found 2 potential issues.

      There are 3 total unresolved issues (including 1 from previous review).

      Autofix Details

      Bugbot Autofix prepared a fix for 1 of the 2 issues found in the latest run.

      • ✅ Fixed: Hosted pairing may save environment with empty label
        • Added request.host as a fallback when request.label is empty, so environments saved without an explicit label param get the host URL as their display name.

      Create PR

      Or push these changes by commenting:

      @cursor push 3f83a69a21
      Preview (pingdotgg/t3code@3f83a69a21)
      diff --git a/apps/web/src/components/auth/PairingRouteSurface.tsx b/apps/web/src/components/auth/PairingRouteSurface.tsx
      --- a/apps/web/src/components/auth/PairingRouteSurface.tsx
      +++ b/apps/web/src/components/auth/PairingRouteSurface.tsx
      @@ -195,7 +195,7 @@
       
           try {
             const record = await addSavedEnvironment({
      -        label: request.label,
      +        label: request.label || request.host,
               host: request.host,
               pairingCode: request.token,
             });
      You can send follow-ups to the cloud agent here.
    23. packages/shared/src/keybindings.ts lines 53 to 55Resolvedby juliusmarminge
    24. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      Autofix Details

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Timeout errors bypass cancellation detection and throw raw
        • Extended isSshPasswordPromptCancellation to also match 'timed out' in the error message so timeout rejections are treated as graceful cancellations and return the SSH_PASSWORD_PROMPT_CANCELLED_RESULT sentinel.

      Create PR

      Or push these changes by commenting:

      @cursor push 97efd98697
      Preview (pingdotgg/t3code@97efd98697)
      diff --git a/apps/desktop/src/sshEnvironment.ts b/apps/desktop/src/sshEnvironment.ts
      --- a/apps/desktop/src/sshEnvironment.ts
      +++ b/apps/desktop/src/sshEnvironment.ts
      @@ -204,9 +204,9 @@
       }
       
       function isSshPasswordPromptCancellation(error: unknown): error is SshPasswordPromptError {
      -  return (
      -    error instanceof SshPasswordPromptError && error.message.toLowerCase().includes("cancelled")
      -  );
      +  if (!(error instanceof SshPasswordPromptError)) return false;
      +  const msg = error.message.toLowerCase();
      +  return msg.includes("cancelled") || msg.includes("timed out");
       }
       
       /**
      You can send follow-ups to the cloud agent here.
    25. Cursor Bugbot has reviewed your changes and found 1 potential issue.

      There are 2 total unresolved issues (including 1 from previous review).

      Fix All in Cursor

      Bugbot Autofix prepared a fix for the issue found in the latest run.

      • ✅ Fixed: Ref-based render gate won't trigger re-render after error
        • Converted tokenSubmittedRef from useRef to useState so that setting it to false in the catch block triggers a re-render and the 'Try again' button appears correctly.

      Create PR

      Or push these changes by commenting:

      @cursor push 76040bdce4
      Preview (pingdotgg/t3code@76040bdce4)
      diff --git a/apps/web/src/components/auth/PairingRouteSurface.tsx b/apps/web/src/components/auth/PairingRouteSurface.tsx
      --- a/apps/web/src/components/auth/PairingRouteSurface.tsx
      +++ b/apps/web/src/components/auth/PairingRouteSurface.tsx
      @@ -172,7 +172,7 @@
             : "This pairing link is missing its backend host or token.",
         );
         const submitAttemptedRef = useRef(false);
      -  const tokenSubmittedRef = useRef(false);
      +  const [tokenSubmitted, setTokenSubmitted] = useState(false);
       
         const submitHostedPairingRequest = useCallback(async () => {
           const request = hostedPairingRequestRef.current;
      @@ -183,7 +183,7 @@
             return;
           }
       
      -    if (tokenSubmittedRef.current) {
      +    if (tokenSubmitted) {
             setStatus("error");
             setMessage("This one-time pairing token was already submitted. Request a new pairing link.");
             return;
      @@ -191,7 +191,7 @@
       
           setStatus("pairing");
           setMessage("Connecting to this backend.");
      -    tokenSubmittedRef.current = true;
      +    setTokenSubmitted(true);
       
           try {
             const record = await addSavedEnvironment({
      @@ -202,13 +202,13 @@
             setStatus("paired");
             setMessage(`${record.label} is saved in this browser.`);
           } catch (error) {
      -      tokenSubmittedRef.current = false;
      +      setTokenSubmitted(false);
             setStatus("error");
             setMessage(
               `${errorMessageFromUnknown(error)} If the backend accepted this one-time token, request a new pairing link before retrying.`,
             );
           }
      -  }, []);
      +  }, [tokenSubmitted]);
       
         useEffect(() => {
           if (submitAttemptedRef.current) {
      @@ -261,7 +261,7 @@
                   <Button disabled size="sm">
                     Pairing...
                   </Button>
      -          ) : !tokenSubmittedRef.current ? (
      +          ) : !tokenSubmitted ? (
                   <Button size="sm" onClick={() => void submitHostedPairingRequest()}>
                     Try again
                   </Button>
      You can send follow-ups to the cloud agent here. Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit cab05c74f34280e9c653cd0c9c3859cc03fffab3. Configure [here](https://www.cursor.com/dashboard/bugbot).

Sign in to join this conversation.