@devries-cameron20 / t3code Mirror · read-only / commits / 1c3d5f7e82
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 21:00 UTC

fix(web): a link to a thread on a linked machine no longer opens a blank pane (#34657)

Julius Marminge committed Nov 11, 2026 at 16:37 UTC 1c3d5f7e82644ce847033a0c82d9b9c8253ebc07
2 files changed +31 -2
apps/web/src/components/chat/MarkdownThreadLink.browser.test.tsx
+24
@@ -21,6 +21,12 @@ vi.mock(import("../../state/entities"), () => ({
21 useProject: (ref: { projectId: string } | null) =>
22 ref?.projectId === "essay-project" ? ({ title: "Essays" } as never) : null,
23 }));
24 +vi.mock(import("../../state/environments"), () => ({
25 + useEnvironmentIdentities: () => [
26 + { environmentId: EnvironmentId.make("environment"), label: "Here" },
27 + { environmentId: EnvironmentId.make("remote"), label: "Remote" },
28 + ],
29 +}));
30 vi.mock(import("../ProjectFavicon"), () => ({
31 ProjectFavicon: () => (
32 <span role="img" aria-label="Essays project icon">
@@ -132,3 +138,21 @@ it.each([
138 }
139 },
140 );
141 +
142 +it("names a thread on a machine this client has no connection to, without waiting on it", async () => {
143 + const { registry } = setup();
144 + using _registry = { [Symbol.dispose]: () => registry.dispose() };
145 + await using screen = await render(
146 + <RegistryContext value={registry}>
147 + <MarkdownThreadLink
148 + environmentId={EnvironmentId.make("environment")}
149 + link={{ environmentId: EnvironmentId.make("peer"), threadId: ThreadId.make("peer-thread") }}
150 + label={null}
151 + />
152 + </RegistryContext>,
153 + );
154 + await expect
155 + .element(screen.getByText("Thread on another machine", { exact: true }))
156 + .toBeVisible();
157 + await expect.element(screen.getByRole("link")).not.toBeInTheDocument();
158 +});
apps/web/src/components/chat/MarkdownThreadLink.tsx
+7 -2
@@ -9,6 +9,7 @@ import {
9
10 import { configuredHostedAppUrl } from "../../hostedPairing";
11 import { useThreadRefs, useThreadShell } from "../../state/entities";
12 +import { useEnvironmentIdentities } from "../../state/environments";
13 import { orchestrationEnvironment } from "../../state/orchestration";
14 import { useEnvironmentQuery } from "../../state/query";
15 import { UnresolvedChip } from "../contextChipParts";
@@ -23,8 +24,12 @@ export function MarkdownThreadLink(props: {
24 const candidates = threadLinkCandidates(props.link, props.environmentId);
25 const writtenRef = candidates[0]!;
26 const written = useThreadShell(writtenRef);
27 + // A linked machine's threads are reachable only through its server, not from this client.
28 + const reachable = useEnvironmentIdentities().some(
29 + (environment) => environment.environmentId === writtenRef.environmentId,
30 + );
31 const lookup = useEnvironmentQuery(
27 - written === null
32 + written === null && reachable
33 ? orchestrationEnvironment.threadLinkMetadata({
34 environmentId: writtenRef.environmentId,
35 input: { threadIds: candidates.map((ref) => ref.threadId) },
@@ -39,7 +44,7 @@ export function MarkdownThreadLink(props: {
44 const metadata = lookup.data?.[ref.threadId];
45 return metadata ? [{ ref, metadata }] : [];
46 })[0] ?? null);
42 - const missing = target === null && settled;
47 + const missing = target === null && (settled || !reachable);
48 const guess = missing && props.link.environmentId === null;
49 const refs = useThreadRefs(guess);
50 const remoteRef = guess