From cea6deea57baf4a215b5b679de43e1bfab0c5a5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Ayd=C4=B1n?= Date: Thu, 12 Nov 2026 13:18:21 +0300 Subject: [PATCH 1/2] fix(web): import sessions from connected non-primary environments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Welcome page only scans the primary environment, so sessions on a connected non-primary environment could not be imported. Settings → Environments now has Import sessions… in each connected environment's menu, which opens the Welcome page for that environment. Co-Authored-By: Claude Opus 5.5 --- .../settings/SavedEnvironmentRows.tsx | 13 +++++- .../src/onboarding/welcomePage.logic.test.ts | 46 +++++++++++++++++++ apps/web/src/onboarding/welcomePage.logic.ts | 20 ++++++++ apps/web/src/routes/welcome.tsx | 26 ++++++++--- docs/user/welcome-page.md | 6 +++ 5 files changed, 104 insertions(+), 7 deletions(-) diff --git a/apps/web/src/components/settings/SavedEnvironmentRows.tsx b/apps/web/src/components/settings/SavedEnvironmentRows.tsx index 866841b4bc6b7..702ee4c5de869 100644 --- a/apps/web/src/components/settings/SavedEnvironmentRows.tsx +++ b/apps/web/src/components/settings/SavedEnvironmentRows.tsx @@ -6,8 +6,10 @@ import { RouteIcon, } from "lucide-react"; import { useAtomValue } from "@effect/atom-react"; +import { useNavigate } from "@tanstack/react-router"; import { useEffect, useEffectEvent, useState } from "react"; import { + AuthOrchestrationOperateScope, AuthRelayWriteScope, type EnvironmentId, connectReachabilityHelpUrl, @@ -55,7 +57,7 @@ import { useManagedTunnelUsage } from "~/cloud/managedRelayState"; import { useT3ConnectAccountPage } from "../clerk/T3ConnectAccountPages"; import { TunnelLimitAlert, TunnelUsageMeter } from "../cloud/TunnelUsage"; import { environmentCatalog } from "~/connection/catalog"; -import { readEnvironmentScope } from "~/state/session"; +import { readEnvironmentScope, useEnvironmentScope } from "~/state/session"; import { type EnvironmentPresentation, useRelayEnvironmentDiscovery } from "~/state/environments"; import { APP_VERSION } from "~/branding"; import { useManagedPolicy } from "~/state/managedPolicy"; @@ -124,6 +126,10 @@ export function SavedBackendListRow({ const enabled = environment.entry.enabled && !unsupported; const isConnected = environment.connection.phase === "connected"; const isRemoving = removingEnvironmentId === environmentId; + const navigate = useNavigate(); + // Opens the Welcome page for this row's computer, which then scans that computer's history. + const canImportSessions = + useEnvironmentScope(environmentId, AuthOrchestrationOperateScope) && enabled && isConnected; const errorTraceId = environment.connection.traceId; const { copyToClipboard: copyTraceIdToClipboard } = useCopyToClipboard<{ traceId: string }>({ target: "trace ID", @@ -418,6 +424,11 @@ export function SavedBackendListRow({ {routesOpen ? "Hide routes" : "Routes"} + {canImportSessions ? ( + void navigate({ to: "/welcome", search: { environmentId } })}> + Import sessions… + + ) : null} {mcpUrl ? ( copyMcpUrl(mcpUrl, { url: mcpUrl })}>Copy MCP URL ) : null} diff --git a/apps/web/src/onboarding/welcomePage.logic.test.ts b/apps/web/src/onboarding/welcomePage.logic.test.ts index d2e8600692945..4cbb3375e0c7a 100644 --- a/apps/web/src/onboarding/welcomePage.logic.test.ts +++ b/apps/web/src/onboarding/welcomePage.logic.test.ts @@ -14,6 +14,7 @@ import { codexCardProvider, codexNeedsSetup, groupWelcomeAgents, + resolveWelcomeEnvironmentId, turnedOnInstance, welcomeOffersPhone, } from "./welcomePage.logic"; @@ -263,3 +264,48 @@ describe("welcomeOffersPhone", () => { expect(offers({ isPrimary: false })).toBe(false); }); }); + +describe("resolveWelcomeEnvironmentId", () => { + const base = { + resumeEnvironmentId: undefined, + requestedEnvironmentId: undefined, + primaryEnvironmentId: "primary", + knownEnvironmentIds: ["primary", "remote", "other"], + }; + + it("sets up this computer by default", () => { + expect(resolveWelcomeEnvironmentId(base)).toBe("primary"); + }); + + it("opens a connected computer that Settings asked for", () => { + expect(resolveWelcomeEnvironmentId({ ...base, requestedEnvironmentId: "remote" })).toBe( + "remote", + ); + }); + + it("lets a ChatGPT sign-in return to the computer it set up", () => { + expect( + resolveWelcomeEnvironmentId({ + ...base, + resumeEnvironmentId: "other", + requestedEnvironmentId: "remote", + }), + ).toBe("other"); + }); + + it("ignores a computer the catalog does not know", () => { + expect(resolveWelcomeEnvironmentId({ ...base, requestedEnvironmentId: "gone" })).toBe( + "primary", + ); + }); + + it("opens a connected computer without a primary one, as in the hosted app", () => { + expect( + resolveWelcomeEnvironmentId({ + ...base, + primaryEnvironmentId: null, + requestedEnvironmentId: "remote", + }), + ).toBe("remote"); + }); +}); diff --git a/apps/web/src/onboarding/welcomePage.logic.ts b/apps/web/src/onboarding/welcomePage.logic.ts index acde259ad0d5d..28364e59d7684 100644 --- a/apps/web/src/onboarding/welcomePage.logic.ts +++ b/apps/web/src/onboarding/welcomePage.logic.ts @@ -178,3 +178,23 @@ export function codexCardProvider(input: { welcomeAgentState(provider, input.settings) === "checking"; return open ? provider : null; } + +/** + * The computer the Welcome page sets up. A ChatGPT sign-in returns to the computer it set up, and + * Settings opens the page for a connected computer; either id counts only once the catalog knows + * it, so an unknown one falls back to this computer. + */ +export function resolveWelcomeEnvironmentId(input: { + readonly resumeEnvironmentId: Id | undefined; + readonly requestedEnvironmentId: Id | undefined; + readonly primaryEnvironmentId: Id | null; + readonly knownEnvironmentIds: ReadonlyArray; +}): Id | null { + const known = (id: Id | undefined) => + id !== undefined && input.knownEnvironmentIds.includes(id) ? id : undefined; + return ( + known(input.resumeEnvironmentId) ?? + known(input.requestedEnvironmentId) ?? + input.primaryEnvironmentId + ); +} diff --git a/apps/web/src/routes/welcome.tsx b/apps/web/src/routes/welcome.tsx index 5fbb52359a1cf..1e970711f266e 100644 --- a/apps/web/src/routes/welcome.tsx +++ b/apps/web/src/routes/welcome.tsx @@ -7,6 +7,7 @@ import * as Option from "effect/Option"; import { NoProjectsHero } from "../components/NoProjectsHero"; import { WelcomePage } from "../components/onboarding/WelcomePage"; import { useNewThreadHandler } from "../hooks/useHandleNewThread"; +import { resolveWelcomeEnvironmentId } from "../onboarding/welcomePage.logic"; import { useEnvironments, usePrimaryEnvironmentId } from "../state/environments"; const decodeEnvironmentId = Schema.decodeOption(EnvironmentId); @@ -18,6 +19,14 @@ export const Route = createFileRoute("/welcome")({ throw redirect({ to: "/pair", replace: true }); } }, + // Settings → Environments opens the page for a connected computer to import its history. + validateSearch: (raw: Record): { environmentId?: EnvironmentId } => { + const environmentId = + typeof raw.environmentId === "string" + ? Option.getOrUndefined(decodeEnvironmentId(raw.environmentId)) + : undefined; + return environmentId === undefined ? {} : { environmentId }; + }, component: WelcomeRouteView, }); @@ -28,15 +37,20 @@ function WelcomeRouteView() { const resumeEnvironmentId = hash.startsWith("agents:") ? Option.getOrUndefined(decodeEnvironmentId(hash.slice("agents:".length))) : undefined; + const requestedEnvironmentId = Route.useSearch({ select: (search) => search.environmentId }); const primaryEnvironmentId = usePrimaryEnvironmentId(); const { environments, isReady } = useEnvironments(); - // Trust the id only once the catalog has it; an unknown computer falls back to this one. const waitingForCatalog = - !isReady && (resumeEnvironmentId !== undefined || primaryEnvironmentId === null); - const resumeKnown = - resumeEnvironmentId !== undefined && - environments.some((environment) => environment.environmentId === resumeEnvironmentId); - const environmentId = (resumeKnown ? resumeEnvironmentId : undefined) ?? primaryEnvironmentId; + !isReady && + (resumeEnvironmentId !== undefined || + requestedEnvironmentId !== undefined || + primaryEnvironmentId === null); + const environmentId = resolveWelcomeEnvironmentId({ + resumeEnvironmentId, + requestedEnvironmentId, + primaryEnvironmentId, + knownEnvironmentIds: environments.map((environment) => environment.environmentId), + }); // The root can remount this pending outlet after navigation; do not reopen setup. const isWelcomeRoute = useLocation({ select: (location) => location.pathname === "/welcome" }); const [dismissed, setDismissed] = useState(false); diff --git a/docs/user/welcome-page.md b/docs/user/welcome-page.md index f280ace079147..b9171aa8e283f 100644 --- a/docs/user/welcome-page.md +++ b/docs/user/welcome-page.md @@ -8,6 +8,12 @@ and the phone app. Only an agent is needed to start chatting. To see the page again, go to **Settings → About → Welcome page** and select **Open**. Direct links, such as Settings, open normally before setup is done. +The page sets up the computer you are using. To import projects and sessions from +another connected computer, go to **Settings → Environments**, open that +computer's **⋯** menu and select **Import sessions…**. The Welcome page then +lists that computer's agents and its Claude Code, Codex, and Pi history. The +option needs a connected computer and a connection that can import projects. + The hosted app at app.t3.codes does not open the page. With no computer connected, it asks you to sign in to T3 Connect, then to install T3 Code and run `t3 connect` on your computer. From home, it adds compatible computers linked to your account and From 5d5e7f29579da10e8d84b3fa01272b6fc0820da9 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 19 Nov 2026 18:54:10 +0000 Subject: [PATCH 2/2] fix(web): translate the Import sessions menu item Wraps the new menu label for main's i18n catalogs, translates it in every web locale, and drops a resolver test the fallback case already covers. Co-Authored-By: Claude Opus 5.5 --- apps/web/src/components/settings/SavedEnvironmentRows.tsx | 2 +- apps/web/src/i18n/translations/de.json | 1 + apps/web/src/i18n/translations/en.json | 1 + apps/web/src/i18n/translations/es.json | 1 + apps/web/src/i18n/translations/fr.json | 1 + apps/web/src/i18n/translations/ja.json | 1 + apps/web/src/i18n/translations/ko.json | 1 + apps/web/src/i18n/translations/pt-BR.json | 1 + apps/web/src/i18n/translations/ru.json | 1 + apps/web/src/i18n/translations/sv.json | 1 + apps/web/src/i18n/translations/zh.json | 1 + apps/web/src/onboarding/welcomePage.logic.test.ts | 4 ---- 12 files changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/web/src/components/settings/SavedEnvironmentRows.tsx b/apps/web/src/components/settings/SavedEnvironmentRows.tsx index 73e4948f66daf..28401b6bdd702 100644 --- a/apps/web/src/components/settings/SavedEnvironmentRows.tsx +++ b/apps/web/src/components/settings/SavedEnvironmentRows.tsx @@ -459,7 +459,7 @@ export function SavedBackendListRow({ {canImportSessions ? ( void navigate({ to: "/welcome", search: { environmentId } })}> - Import sessions… + Import sessions… ) : null} {mcpUrl ? ( diff --git a/apps/web/src/i18n/translations/de.json b/apps/web/src/i18n/translations/de.json index 7b125c6298aa4..2e2588f008a9f 100644 --- a/apps/web/src/i18n/translations/de.json +++ b/apps/web/src/i18n/translations/de.json @@ -9387,6 +9387,7 @@ "2c2a12fbdc300d03": "Um diese Einstellungen zu bearbeiten, kopple diese Verbindung mit den Berechtigungen „Relay anzeigen“ und „Relay verwalten“.", "3b3d299149f45c3d": "Klicke auf „Umgebung hinzufügen“, um eine weitere Umgebung zu koppeln, oder verbinde eine über T3 Connect.", "0e4f42dd41b74e9a": "Klicke auf „Umgebung hinzufügen“, um eine weitere Umgebung zu koppeln.", + "777fab9a267277ef": "Sitzungen importieren…", "579a261154e2db62": "MCP-URL kopieren", "4a1e6124e121d54f": "Trace-ID kopieren", "8693499e957364d1": "Mehr Tunnel erhalten", diff --git a/apps/web/src/i18n/translations/en.json b/apps/web/src/i18n/translations/en.json index fc971dba6e051..6e15f64af70a2 100644 --- a/apps/web/src/i18n/translations/en.json +++ b/apps/web/src/i18n/translations/en.json @@ -9395,6 +9395,7 @@ "2c2a12fbdc300d03": "To edit these settings, pair this connection with both View relay and Manage relay permissions.", "3b3d299149f45c3d": "Click “Add environment” to pair another environment, or connect one from T3 Connect.", "0e4f42dd41b74e9a": "Click “Add environment” to pair another environment.", + "777fab9a267277ef": "Import sessions…", "579a261154e2db62": "Copy MCP URL", "4a1e6124e121d54f": "Copy trace ID", "8693499e957364d1": "Get more tunnels", diff --git a/apps/web/src/i18n/translations/es.json b/apps/web/src/i18n/translations/es.json index 2bf075b8cde09..eae3ca9c124db 100644 --- a/apps/web/src/i18n/translations/es.json +++ b/apps/web/src/i18n/translations/es.json @@ -9383,6 +9383,7 @@ "2c2a12fbdc300d03": "Para editar estos ajustes, empareja esta conexión con los permisos Ver relay y Gestionar relay.", "3b3d299149f45c3d": "Haz clic en «Añadir entorno» para emparejar otro entorno, o conecta uno desde T3 Connect.", "0e4f42dd41b74e9a": "Haz clic en «Añadir entorno» para emparejar otro entorno.", + "777fab9a267277ef": "Importar sesiones…", "579a261154e2db62": "Copiar URL de MCP", "4a1e6124e121d54f": "Copiar ID de traza", "8693499e957364d1": "Obtener más túneles", diff --git a/apps/web/src/i18n/translations/fr.json b/apps/web/src/i18n/translations/fr.json index 57f3b582c471c..701995f348693 100644 --- a/apps/web/src/i18n/translations/fr.json +++ b/apps/web/src/i18n/translations/fr.json @@ -9385,6 +9385,7 @@ "2c2a12fbdc300d03": "Pour modifier ces paramètres, appairez cette connexion avec les autorisations Voir le relais et Gérer le relais.", "3b3d299149f45c3d": "Cliquez sur « Ajouter un environnement » pour appairer un autre environnement, ou connectez-en un depuis T3 Connect.", "0e4f42dd41b74e9a": "Cliquez sur « Ajouter un environnement » pour appairer un autre environnement.", + "777fab9a267277ef": "Importer des sessions…", "579a261154e2db62": "Copier l’URL MCP", "4a1e6124e121d54f": "Copier l’ID de trace", "8693499e957364d1": "Obtenir plus de tunnels", diff --git a/apps/web/src/i18n/translations/ja.json b/apps/web/src/i18n/translations/ja.json index 1032927325af6..e784103c671b2 100644 --- a/apps/web/src/i18n/translations/ja.json +++ b/apps/web/src/i18n/translations/ja.json @@ -9340,6 +9340,7 @@ "2c2a12fbdc300d03": "これらの設定を編集するには、「リレーの表示」と「リレーの管理」の両方の権限でこの接続をペアリングしてください。", "3b3d299149f45c3d": "「環境を追加」をクリックして別の環境をペアリングするか、T3 Connect から接続してください。", "0e4f42dd41b74e9a": "「環境を追加」をクリックして別の環境をペアリングしてください。", + "777fab9a267277ef": "セッションをインポート…", "579a261154e2db62": "MCP URL をコピー", "4a1e6124e121d54f": "トレース ID をコピー", "8693499e957364d1": "トンネルを追加で入手", diff --git a/apps/web/src/i18n/translations/ko.json b/apps/web/src/i18n/translations/ko.json index d918ed423daef..ceba0e379a041 100644 --- a/apps/web/src/i18n/translations/ko.json +++ b/apps/web/src/i18n/translations/ko.json @@ -9343,6 +9343,7 @@ "2c2a12fbdc300d03": "이 설정을 편집하려면 릴레이 보기 및 릴레이 관리 권한을 모두 사용해 이 연결을 페어링하세요.", "3b3d299149f45c3d": "다른 환경을 페어링하려면 “환경 추가”를 클릭하거나 T3 Connect에서 연결하세요.", "0e4f42dd41b74e9a": "다른 환경을 페어링하려면 “환경 추가”를 클릭하세요.", + "777fab9a267277ef": "세션 가져오기…", "579a261154e2db62": "MCP URL 복사", "4a1e6124e121d54f": "추적 ID 복사", "8693499e957364d1": "터널 더 받기", diff --git a/apps/web/src/i18n/translations/pt-BR.json b/apps/web/src/i18n/translations/pt-BR.json index f2a498937efd8..e837e51ef0163 100644 --- a/apps/web/src/i18n/translations/pt-BR.json +++ b/apps/web/src/i18n/translations/pt-BR.json @@ -9384,6 +9384,7 @@ "2c2a12fbdc300d03": "Para editar estas configurações, pareie esta conexão com as permissões View relay e Manage relay.", "3b3d299149f45c3d": "Clique em “Adicionar ambiente” para parear outro ambiente ou conecte um pelo T3 Connect.", "0e4f42dd41b74e9a": "Clique em “Adicionar ambiente” para parear outro ambiente.", + "777fab9a267277ef": "Importar sessões…", "579a261154e2db62": "Copiar URL do MCP", "4a1e6124e121d54f": "Copiar ID de rastreamento", "8693499e957364d1": "Obter mais túneis", diff --git a/apps/web/src/i18n/translations/ru.json b/apps/web/src/i18n/translations/ru.json index 5823e9e268e26..492f8112707e9 100644 --- a/apps/web/src/i18n/translations/ru.json +++ b/apps/web/src/i18n/translations/ru.json @@ -9387,6 +9387,7 @@ "2c2a12fbdc300d03": "Чтобы менять эти настройки, выполните сопряжение этого подключения с разрешениями View relay и Manage relay.", "3b3d299149f45c3d": "Нажмите «Добавить окружение», чтобы выполнить сопряжение с другим окружением, или подключите его из T3 Connect.", "0e4f42dd41b74e9a": "Нажмите «Добавить окружение», чтобы выполнить сопряжение с другим окружением.", + "777fab9a267277ef": "Импортировать сеансы…", "579a261154e2db62": "Копировать URL MCP", "4a1e6124e121d54f": "Копировать ID трассировки", "8693499e957364d1": "Получить больше туннелей", diff --git a/apps/web/src/i18n/translations/sv.json b/apps/web/src/i18n/translations/sv.json index c42afb6d94fbc..bae254f807533 100644 --- a/apps/web/src/i18n/translations/sv.json +++ b/apps/web/src/i18n/translations/sv.json @@ -9393,6 +9393,7 @@ "2c2a12fbdc300d03": "Parkoppla den här anslutningen med både behörigheterna Visa relä och Hantera relä för att redigera de här inställningarna.", "3b3d299149f45c3d": "Klicka på ”Lägg till miljö” för att parkoppla en annan miljö, eller anslut en från T3 Connect.", "0e4f42dd41b74e9a": "Klicka på ”Lägg till miljö” för att parkoppla en annan miljö.", + "777fab9a267277ef": "Importera sessioner…", "579a261154e2db62": "Kopiera MCP-URL", "4a1e6124e121d54f": "Kopiera spårnings-ID", "8693499e957364d1": "Skaffa fler tunnlar", diff --git a/apps/web/src/i18n/translations/zh.json b/apps/web/src/i18n/translations/zh.json index 4a7cd89260f3f..9f09fd569f473 100644 --- a/apps/web/src/i18n/translations/zh.json +++ b/apps/web/src/i18n/translations/zh.json @@ -9401,6 +9401,7 @@ "2c2a12fbdc300d03": "要编辑这些设置,请在配对此连接时同时授予“查看中继”和“管理中继”权限。", "3b3d299149f45c3d": "点击“添加环境”配对其他环境,或从 T3 Connect 连接一个环境。", "0e4f42dd41b74e9a": "点击“添加环境”配对其他环境。", + "777fab9a267277ef": "导入会话…", "579a261154e2db62": "复制 MCP URL", "4a1e6124e121d54f": "复制追踪 ID", "8693499e957364d1": "获取更多隧道", diff --git a/apps/web/src/onboarding/welcomePage.logic.test.ts b/apps/web/src/onboarding/welcomePage.logic.test.ts index 4cbb3375e0c7a..dc3f2671443c7 100644 --- a/apps/web/src/onboarding/welcomePage.logic.test.ts +++ b/apps/web/src/onboarding/welcomePage.logic.test.ts @@ -273,10 +273,6 @@ describe("resolveWelcomeEnvironmentId", () => { knownEnvironmentIds: ["primary", "remote", "other"], }; - it("sets up this computer by default", () => { - expect(resolveWelcomeEnvironmentId(base)).toBe("primary"); - }); - it("opens a connected computer that Settings asked for", () => { expect(resolveWelcomeEnvironmentId({ ...base, requestedEnvironmentId: "remote" })).toBe( "remote",