Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d695ffe
fix(desktop,web): Open in runs locally for a background service shari…
KinanLak Oct 19, 2026
c4bc20c
fix(desktop): read the home environment ID without suspending the syn…
KinanLak Oct 19, 2026
e80e4f0
fix(desktop): log unexpected failures reading the home environment ID
KinanLak Oct 19, 2026
3fe9abd
Merge remote-tracking branch 'origin/main' into fix/local-link-actions
KinanLak Oct 20, 2026
163b13d
Merge remote-tracking branch 'origin/main' into fix/resolve-pr-conflicts
KinanLak Oct 28, 2026
94b27d8
fix(web): Open In treats both the primary and the desktop home's serv…
KinanLak Oct 28, 2026
c0ad4be
chore: merge main into local editor fix
maria-rcks Oct 30, 2026
02c5c50
refactor(web): simplify shared-home editor selection
maria-rcks Oct 30, 2026
5633aee
fix(web): refresh home identity when connections change
maria-rcks Oct 30, 2026
590f811
test(web): include home identity in desktop link mock
maria-rcks Oct 30, 2026
703b864
chore: merge main into local link actions
maria-rcks Nov 1, 2026
24bf05b
Merge branch 'main' into fix/local-link-actions
KinanLak Nov 2, 2026
99006e1
ci: retrigger
KinanLak Nov 2, 2026
913144a
Merge remote-tracking branch 'github/main' into takeover-21661
maria-rcks Nov 2, 2026
87b09ef
Merge remote-tracking branch 'origin/main' into pr-21661
KinanLak Nov 10, 2026
8cbefd2
Merge remote-tracking branch 'origin/main' into fix/local-link-actions
juliusmarminge Nov 11, 2026
95fa3bd
test(web): keep Open in host-environment coverage beside its modules
juliusmarminge Nov 11, 2026
ecc0d44
Merge remote-tracking branch 'origin/main' into fix/local-link-actions
juliusmarminge Nov 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/web/src/components/ChatMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ import {
import { isMarkdownFileLinkLabel } from "@t3tools/shared/markdownLinks";
import { isElectron } from "../env";
import { readLocalApi } from "../localApi";
import { appAtomRegistry } from "../rpc/atomRegistry";
import { hostEnvironmentIdAtom } from "../state/primaryEnvironment";
import { cn } from "../lib/utils";
import { resolveRemoteOpenState, useRemoteOpenResolution } from "../remoteOpen";
import { useRightPanelStore } from "../rightPanelStore";
Expand Down Expand Up @@ -610,6 +612,7 @@ function useChatMarkdownState({
sshTarget: null,
remoteOpenTargets: undefined,
isDesktopRenderer: window.desktopBridge !== undefined,
hostEnvironmentId: appAtomRegistry.get(hostEnvironmentIdAtom),
}).mode !== "local-exec"
) {
description = `The file was not found on ${target.label} at ${error.checkedPath ?? error.resource.path}.`;
Expand Down
23 changes: 23 additions & 0 deletions apps/web/src/components/ChatView.logic.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { shouldShowOpenInPicker } from "./chat/OpenInPicker.logic";
import {
boundAttachmentIds,
buildExpiredTerminalContextToastCopy,
Expand Down Expand Up @@ -1216,3 +1217,25 @@ describe("deriveAvailableRevertTurnCounts", () => {
expect(deriveAvailableRevertTurnCounts(null).size).toBe(0);
});
});

describe("Open in for the host environment", () => {
it("shows both local environments when the primary has a separate WSL home", () => {
const primaryEnvironmentId = EnvironmentId.make("wsl");
const hostEnvironmentId = EnvironmentId.make("host");
for (const [activeThreadEnvironmentId, visible] of [
[primaryEnvironmentId, true],
[hostEnvironmentId, true],
[EnvironmentId.make("other"), false],
] as const) {
expect(
shouldShowOpenInPicker({
activeProjectName: "Project",
activeThreadEnvironmentId,
primaryEnvironmentId,
hostEnvironmentId,
remoteOpenMode: "local-exec",
}),
).toBe(visible);
}
});
});
22 changes: 11 additions & 11 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,8 @@ import { selectThreadTerminalUiState, useTerminalUiStateStore } from "../termina
import { useKnownTerminalSessions, useThreadRunningTerminalIds } from "../state/terminalSessions";
import { useEnvironmentQueryRefresh } from "../state/query";
import { useEnvironmentScope } from "~/state/session";
import {
primaryServerAvailableEditorsAtom,
primaryServerKeybindingsAtom,
serverEnvironment,
} from "../state/server";
import { primaryServerKeybindingsAtom, serverEnvironment } from "../state/server";
import { hostEnvironmentIdAtom } from "../state/primaryEnvironment";
import { threadEnvironment } from "../state/threads";
import { resolveProviderSkillsForCwd } from "@t3tools/client-runtime/providerSkills";
import { chatGitStatusAtom, NO_CHAT_GIT_STATUS_ATOM, vcsEnvironment } from "../state/vcs";
Expand Down Expand Up @@ -1172,7 +1169,6 @@ export default function ChatView(props: ChatViewProps) {
useRightPanelStore.getState().reconcileFileSurfaces(activeThreadRef, activeProject !== null);
}, [activeEnvironmentBootstrapComplete, activeProject, activeThreadRef]);

const primaryEnvironmentId = primaryEnvironment?.environmentId ?? null;
const activeEnvironment =
activeThread == null ? null : (environmentById.get(activeThread.environmentId) ?? null);
const activeEnvironmentUnavailable =
Expand Down Expand Up @@ -1627,17 +1623,21 @@ export default function ChatView(props: ChatViewProps) {
const scriptKeybindings =
useAtomValue(serverEnvironment.configValueAtom(environmentId))?.keybindings ??
DEFAULT_RESOLVED_KEYBINDINGS;
const availableEditors = useAtomValue(primaryServerAvailableEditorsAtom);
const remoteOpenState = useRemoteOpenState(activeThread?.environmentId ?? environmentId);
const openInEnvironmentId = activeThread?.environmentId ?? environmentId;
const availableEditors =
useAtomValue(serverEnvironment.configValueAtom(openInEnvironmentId))?.availableEditors ?? [];
const hostEnvironmentId = useAtomValue(hostEnvironmentIdAtom);
const remoteOpenState = useRemoteOpenState(openInEnvironmentId);
const showOpenInPicker = shouldShowOpenInPicker({
activeProjectName: activeProject?.title,
activeThreadEnvironmentId: activeThread?.environmentId ?? environmentId,
primaryEnvironmentId,
activeThreadEnvironmentId: openInEnvironmentId,
primaryEnvironmentId: primaryEnvironment?.environmentId ?? null,
hostEnvironmentId,
remoteOpenMode: remoteOpenState.mode,
});
useOpenFavoriteEditorShortcut({
enabled: showOpenInPicker && !backgroundThread,
environmentId: activeThread?.environmentId ?? environmentId,
environmentId: openInEnvironmentId,
keybindings,
availableEditors,
openInCwd: gitCwd,
Expand Down
26 changes: 26 additions & 0 deletions apps/web/src/components/chat/OpenInPicker.logic.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { EnvironmentId } from "@t3tools/contracts";
import { describe, expect, it } from "vite-plus/test";

import { shouldShowOpenInPicker } from "./OpenInPicker.logic";

describe("shouldShowOpenInPicker", () => {
it("shows both local environments when the primary has a separate WSL home", () => {
const primaryEnvironmentId = EnvironmentId.make("wsl");
const hostEnvironmentId = EnvironmentId.make("host");
for (const [activeThreadEnvironmentId, visible] of [
[primaryEnvironmentId, true],
[hostEnvironmentId, true],
[EnvironmentId.make("other"), false],
] as const) {
expect(
shouldShowOpenInPicker({
activeProjectName: "Project",
activeThreadEnvironmentId,
primaryEnvironmentId,
hostEnvironmentId,
remoteOpenMode: "local-exec",
}),
).toBe(visible);
}
});
});
5 changes: 3 additions & 2 deletions apps/web/src/components/chat/OpenInPicker.logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ export function shouldShowOpenInPicker(input: {
readonly activeProjectName: string | undefined;
readonly activeThreadEnvironmentId: EnvironmentId;
readonly primaryEnvironmentId: EnvironmentId | null;
readonly hostEnvironmentId: string | null;
readonly remoteOpenMode: RemoteOpenMode;
}): boolean {
if (!input.activeProjectName) return false;
if (
input.primaryEnvironmentId !== null &&
input.activeThreadEnvironmentId === input.primaryEnvironmentId
input.activeThreadEnvironmentId === input.primaryEnvironmentId ||
input.activeThreadEnvironmentId === input.hostEnvironmentId
) {
return true;
}
Expand Down
6 changes: 5 additions & 1 deletion apps/web/src/components/files/FilePreviewPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ import { buildFileReviewComment } from "~/reviewCommentContext";
import { assetEnvironment } from "~/state/assets";
import { usePreviewAvailable } from "~/browser/previewRuntime";
import { useEnvironmentHttpBaseUrl, usePrimaryEnvironmentId } from "~/state/environments";
import { hostEnvironmentIdAtom } from "~/state/primaryEnvironment";
import { previewEnvironment } from "~/state/preview";
import { serverEnvironment } from "~/state/server";
import { useEnvironmentScope } from "~/state/session";
Expand Down Expand Up @@ -1025,6 +1026,7 @@ export default function FilePreviewPanel({
const wordWrap = wordWrapOverride ?? defaultWordWrap;
const canOperatePreview = useEnvironmentScope(environmentId, AuthPreviewOperateScope);
const primaryEnvironmentId = usePrimaryEnvironmentId();
const hostEnvironmentId = useAtomValue(hostEnvironmentIdAtom);
const remoteOpenState = useRemoteOpenState(environmentId);
const serverConfig = useAtomValue(serverEnvironment.configValueAtom(environmentId));
const environmentHttpBaseUrl = useEnvironmentHttpBaseUrl(environmentId);
Expand Down Expand Up @@ -1281,7 +1283,9 @@ export default function FilePreviewPanel({
</div>
</ScrollArea>
{absolutePath &&
(environmentId === primaryEnvironmentId || remoteOpenState.mode !== "local-exec") ? (
(environmentId === primaryEnvironmentId ||
environmentId === hostEnvironmentId ||
remoteOpenState.mode !== "local-exec") ? (
<OpenInPicker
environmentId={environmentId}
keybindings={keybindings}
Expand Down
36 changes: 36 additions & 0 deletions apps/web/src/remoteOpen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe("resolveRemoteOpenState", () => {
sshTarget: null,
isDesktopRenderer: false,
remoteOpenTargets: TAILSCALE_TARGETS,
hostEnvironmentId: null,
}),
).toEqual({ mode: "local-exec" });
});
Expand All @@ -42,6 +43,7 @@ describe("resolveRemoteOpenState", () => {
sshTarget: null,
isDesktopRenderer: false,
remoteOpenTargets: TAILSCALE_TARGETS,
hostEnvironmentId: null,
}),
).toEqual({
mode: "remote-links",
Expand All @@ -57,10 +59,40 @@ describe("resolveRemoteOpenState", () => {
sshTarget: null,
isDesktopRenderer: true,
remoteOpenTargets: TAILSCALE_TARGETS,
hostEnvironmentId: null,
}),
).toEqual({ mode: "local-exec" });
});

it("keeps exec behavior for the environment that owns the desktop's T3 home", () => {
// With Local environment off, a background service on this machine can own the
// desktop's home and still be reached through T3 Connect.
expect(
resolveRemoteOpenState({
target: new RelayConnectionTarget({ environmentId, label: "sol" }),
sshTarget: null,
isDesktopRenderer: true,
remoteOpenTargets: TAILSCALE_TARGETS,
hostEnvironmentId: environmentId,
}),
).toEqual({ mode: "local-exec" });
});

it("uses deep links for other environments when the desktop home has its own", () => {
expect(
resolveRemoteOpenState({
target: new RelayConnectionTarget({ environmentId, label: "sol" }),
sshTarget: null,
isDesktopRenderer: true,
remoteOpenTargets: TAILSCALE_TARGETS,
hostEnvironmentId: EnvironmentId.make("environment-host"),
}),
).toEqual({
mode: "remote-links",
host: { kind: "tailscale", host: "sol.tail1234.ts.net" },
});
});

it("leaves a bare desktop SSH alias for the editor to resolve through SSH config", () => {
const state = resolveRemoteOpenState({
target: new SshConnectionTarget({ environmentId, label: "sol", connectionId: "ssh-1" }),
Expand All @@ -69,6 +101,7 @@ describe("resolveRemoteOpenState", () => {
remoteOpenTargets: [
{ kind: "tailscale", host: "sol.tail1234.ts.net", username: "server-user" },
],
hostEnvironmentId: null,
});
expect(state).toEqual({ mode: "remote-links", host: { kind: "ssh-alias", host: "sol" } });
if (state.mode !== "remote-links") throw new Error("Expected a remote link");
Expand Down Expand Up @@ -97,6 +130,7 @@ describe("resolveRemoteOpenState", () => {
sshTarget,
isDesktopRenderer: true,
remoteOpenTargets: TAILSCALE_TARGETS,
hostEnvironmentId: null,
});
expect(state.mode).toBe("remote-links");
if (state.mode !== "remote-links") throw new Error("Expected a remote link");
Expand All @@ -121,6 +155,7 @@ describe("resolveRemoteOpenState", () => {
remoteOpenTargets: [
{ kind: "tailscale", host: "server.tail1234.ts.net", username: "admin-user" },
],
hostEnvironmentId: null,
});
expect(state.mode).toBe("remote-links");
if (state.mode !== "remote-links") throw new Error("Expected a remote link");
Expand All @@ -137,6 +172,7 @@ describe("resolveRemoteOpenState", () => {
sshTarget: null,
isDesktopRenderer: false,
remoteOpenTargets,
hostEnvironmentId: null,
}),
).toEqual({ mode: "remote-unavailable" });
}
Expand Down
5 changes: 4 additions & 1 deletion apps/web/src/remoteOpen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { isDesktopLocalConnectionTarget } from "~/connection/desktopLocal";
import { isLoopbackHostname } from "~/environments/primary/target";
import { useLocalStorage } from "~/hooks/useLocalStorage";
import { environmentPresentations } from "~/state/presentation";
import { hostEnvironmentIdAtom } from "~/state/primaryEnvironment";

export interface RemoteOpenHost {
readonly kind: "ssh-alias" | RemoteOpenTarget["kind"];
Expand Down Expand Up @@ -53,9 +54,10 @@ export function resolveRemoteOpenState(input: {
readonly sshTarget: { readonly alias: string; readonly username: string | null } | null;
readonly remoteOpenTargets: ReadonlyArray<RemoteOpenTarget> | undefined;
readonly isDesktopRenderer: boolean;
readonly hostEnvironmentId: string | null;
}): RemoteOpenState {
const { target } = input;
if (target === null) {
if (target === null || target.environmentId === input.hostEnvironmentId) {
return LOCAL_EXEC;
}
if (target._tag === "PrimaryConnectionTarget") {
Expand Down Expand Up @@ -120,6 +122,7 @@ const remoteOpenResolutionAtom = Atom.family((environmentId: EnvironmentId) =>
profile !== null && profile._tag === "SshConnectionProfile" ? profile.target : null,
remoteOpenTargets: presentation?.serverConfig?.remoteOpenTargets,
isDesktopRenderer: window.desktopBridge !== undefined,
hostEnvironmentId: get(hostEnvironmentIdAtom),
}),
isResolved: true,
};
Expand Down
7 changes: 0 additions & 7 deletions apps/web/src/state/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
DEFAULT_SERVER_SETTINGS,
type EditorId,
type EnvironmentId,
type EnvironmentTheme,
type ServerConfig,
Expand Down Expand Up @@ -53,7 +52,6 @@ interface PrimaryServerState {
readonly welcome: ServerLifecycleWelcomePayload | null;
}

const EMPTY_AVAILABLE_EDITORS: ReadonlyArray<EditorId> = [];
export const EMPTY_SERVER_PROVIDERS: ReadonlyArray<ServerProvider> = [];
const EMPTY_PRIMARY_SERVER_STATE: PrimaryServerState = {
config: null,
Expand Down Expand Up @@ -166,11 +164,6 @@ export const primaryServerKeybindingsAtom = createShortcutKeybindingsAtom({
environmentsAtom: environmentConnectionsAtom,
}).pipe(Atom.withLabel("web-primary-server-keybindings"));

export const primaryServerAvailableEditorsAtom = Atom.make(
(get): ReadonlyArray<EditorId> =>
get(primaryServerConfigAtom)?.availableEditors ?? EMPTY_AVAILABLE_EDITORS,
).pipe(Atom.withLabel("web-primary-server-available-editors"));

const EMPTY_ENVIRONMENT_THEMES: ReadonlyArray<EnvironmentTheme> = [];

const themeServerConfigAtom = Atom.make((get): ServerConfig | null => {
Expand Down
3 changes: 3 additions & 0 deletions docs/user/remote-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,9 @@ desktop app, open **Settings → Environments** and switch off **Local
environment**. T3 Code restarts without a local server: no local agents or terminals run, WSL
backends stay off, and other devices can no longer connect to this computer. Your projects,
history, and saved connections are kept, and you keep working through pairing, T3 Connect, or SSH.
If a [background service](./background-service.md) on this computer uses the same T3 home, the
app still treats it as this computer: **Open in** and file reveal for its projects run here,
whichever connection you reach it through.

Switch **Local environment** back on in the same place to restart with your previous local
settings.
Loading