The best way to control Claude Code, Codex and more from any computer or phone
fix(clients): show the right app name and thread context (#18442)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>
chasemakes committed
Nov 11, 2026 at 12:59 UTC
3aea6553d3eda941442eaa36057e9f655b54cfd6
6 files changed
+164
-22
apps/desktop/src/window/DesktopWindow.ts
+4
-2
@@ -734,7 +734,10 @@ export const make = Effect.gen(function* () {
734
runFork(zoomWindow(window, direction));
735
});
736
737
- window.on("page-title-updated", (event) => {
737
+ // The renderer titles the window after the open thread; only a blank title
738
+ // falls back to the app name.
739
+ window.on("page-title-updated", (event, title) => {
740
+ if (title.trim() !== "") return;
741
event.preventDefault();
742
window.setTitle(environment.displayName);
743
});
@@ -817,7 +820,6 @@ export const make = Effect.gen(function* () {
820
}
821
clearDevelopmentLoadRetry();
822
developmentLoadRetryIndex = 0;
820
- window.setTitle(environment.displayName);
823
if (environment.platform === "darwin") syncMacosWindowButtons(window);
824
});
825
window.webContents.on(
apps/web/index.html
+8
-1
@@ -668,7 +668,14 @@
668
white-space: nowrap;
669
}
670
</style>
671
- <title>T3 Code (Beta)</title>
671
+ <script>
672
+ // Desktop's preload injects branding before page scripts. Titling before the <title> below
673
+ // parses keeps Electron from reporting the web build's channel to the window first.
674
+ const desktopDisplayName = window.desktopBridge?.getAppBranding?.()?.displayName;
675
+ if (desktopDisplayName) document.title = desktopDisplayName;
676
+ </script>
677
+ <!-- vite.config.ts stamps the web build's channel into this title. -->
678
+ <title>T3 Code</title>
679
</head>
680
<body>
681
<div id="root">
apps/web/src/appInit.tsx
+83
-14
@@ -1,4 +1,9 @@
1
-import { scopedThreadKey, scopeThreadRef } from "@t3tools/client-runtime/environment";
1
+import {
2
+ scopedThreadKey,
3
+ scopeProjectRef,
4
+ scopeThreadRef,
5
+} from "@t3tools/client-runtime/environment";
6
+import type { ScopedThreadRef } from "@t3tools/contracts";
7
import type { ClientSettings } from "@t3tools/contracts/settings";
8
import { createBrowserHistory, createHashHistory } from "@tanstack/react-router";
9
import * as Schema from "effect/Schema";
@@ -22,7 +27,7 @@ import { startSlowRpcRequestToasts } from "./components/SlowRpcRequestToastCoord
27
import { startThreadNotifications } from "./components/ThreadNotificationCoordinator";
28
import { startGuideRunNotifications } from "./components/pullRequest/guide/PullRequestGuideRunCoordinator";
29
import { APP_BASE_NAME, APP_DISPLAY_NAME, APP_STAGE_LABEL } from "./branding";
25
-import { resolveServerBackedAppDisplayName } from "./branding.logic";
30
+import { resolveServerBackedAppDisplayName, resolveWindowTitle } from "./branding.logic";
31
import { isElectron } from "./env";
32
import {
33
subscribeComposerDraftModelReconciliation,
@@ -48,6 +53,7 @@ import {
53
import { startProviderAuthDelivery } from "./providerAuthDelivery";
54
import { getRouter, type AppRouter } from "./router";
55
import { appAtomRegistry } from "./rpc/atomRegistry";
56
+import { environmentProjects } from "./state/projects";
57
import { primaryServerConfigAtom } from "./state/server";
58
import { environmentShell } from "./state/shell";
59
import { installChatRouteCommands } from "./shortcuts/chatRouteCommands";
@@ -55,7 +61,7 @@ import { startWorkspaceFocus } from "./lib/workspaceFocus";
61
import { installCommandPaletteCommands } from "./shortcuts/commandPaletteCommands";
62
import { registerOpenFavoriteEditorCommand } from "./components/chat/OpenInPickerShortcut";
63
import { environmentThreadShells, threadEnvironment } from "./state/threads";
58
-import { resolveThreadRouteTarget } from "./threadRoutes";
64
+import { resolveActiveThreadRouteRef, resolveThreadRouteTarget } from "./threadRoutes";
65
66
/** Writes appearance settings onto the document, touching only the groups that changed. */
67
function startClientAppearance(): void {
@@ -117,19 +123,82 @@ function startClientAppearance(): void {
123
apply();
124
}
125
120
-function startDocumentTitle(): void {
121
- appAtomRegistry.subscribe(
122
- primaryServerConfigAtom,
123
- (config) => {
124
- document.title = resolveServerBackedAppDisplayName({
126
+function readOpenThreadRef(router: AppRouter): ScopedThreadRef | null {
127
+ const target = resolveThreadRouteTarget(router.state.matches.at(-1)?.params ?? {});
128
+ const draft =
129
+ target?.kind === "draft"
130
+ ? useComposerDraftStore.getState().getDraftSession(target.draftId)
131
+ : null;
132
+ return resolveActiveThreadRouteRef(target, draft);
133
+}
134
+
135
+/** Names the open thread and its project in the window title, or the app when none is open. */
136
+function startDocumentTitle(router: AppRouter): void {
137
+ const readOnGuestPage = () => router.state.matches.some((match) => match.routeId === "/guest");
138
+ let openThreadRef = readOpenThreadRef(router);
139
+ let onGuestPage = readOnGuestPage();
140
+ const write = () => {
141
+ // GuestPage titles the tab after the shared thread.
142
+ if (onGuestPage) return;
143
+ const thread =
144
+ openThreadRef === null
145
+ ? null
146
+ : appAtomRegistry.get(environmentThreadShells.quietThreadShellAtom(openThreadRef));
147
+ const project =
148
+ thread === null
149
+ ? null
150
+ : appAtomRegistry.get(
151
+ environmentProjects.projectAtom(
152
+ scopeProjectRef(thread.environmentId, thread.projectId),
153
+ ),
154
+ );
155
+ const title = resolveWindowTitle({
156
+ appDisplayName: resolveServerBackedAppDisplayName({
157
baseName: APP_BASE_NAME,
158
fallbackDisplayName: APP_DISPLAY_NAME,
159
fallbackStageLabel: APP_STAGE_LABEL,
128
- primaryServerVersion: config?.environment.serverVersion ?? null,
129
- });
130
- },
131
- { immediate: true },
132
- );
160
+ primaryServerVersion:
161
+ appAtomRegistry.get(primaryServerConfigAtom)?.environment.serverVersion ?? null,
162
+ }),
163
+ projectTitle: project?.title ?? null,
164
+ threadTitle: thread?.title ?? null,
165
+ desktop: isElectron,
166
+ });
167
+ // Projects change whenever any project does; most changes leave the title alone.
168
+ if (document.title !== title) document.title = title;
169
+ };
170
+ // The open thread's own shell, since the shell lists skip threads hidden by a tag filter.
171
+ let unsubscribeOpenThread = () => {};
172
+ const watchOpenThread = () => {
173
+ unsubscribeOpenThread();
174
+ unsubscribeOpenThread =
175
+ openThreadRef === null
176
+ ? () => {}
177
+ : appAtomRegistry.subscribe(
178
+ environmentThreadShells.quietThreadShellAtom(openThreadRef),
179
+ write,
180
+ );
181
+ };
182
+ // The draft store changes on every keystroke; only a new open thread matters here.
183
+ const updateOpenThread = () => {
184
+ const next = readOpenThreadRef(router);
185
+ const nextOnGuestPage = readOnGuestPage();
186
+ if (
187
+ nextOnGuestPage === onGuestPage &&
188
+ (next && scopedThreadKey(next)) === (openThreadRef && scopedThreadKey(openThreadRef))
189
+ ) {
190
+ return;
191
+ }
192
+ openThreadRef = next;
193
+ onGuestPage = nextOnGuestPage;
194
+ watchOpenThread();
195
+ write();
196
+ };
197
+ watchOpenThread();
198
+ appAtomRegistry.subscribe(primaryServerConfigAtom, write, { immediate: true });
199
+ appAtomRegistry.subscribe(environmentProjects.projectsAtom, write);
200
+ router.subscribe("onResolved", updateOpenThread);
201
+ useComposerDraftStore.subscribe(updateOpenThread);
202
}
203
204
/**
@@ -180,7 +249,7 @@ export function startAppServices(): AppRouter {
249
installDesktopPasteAsText(window.desktopBridge, window);
250
251
startClientAppearance();
183
- startDocumentTitle();
252
+ startDocumentTitle(router);
253
startHostEnvironmentLookup();
254
startEnvironmentThemeRepaint();
255
startBrowserChromeThemeSync(router);
apps/web/src/branding.logic.ts
+35
@@ -11,6 +11,21 @@ export function formatAppDisplayName(input: {
11
return `${input.baseName} (${input.stageLabel})`;
12
}
13
14
+export function resolveHostedAppChannelLabel(channel: string | null | undefined): string | null {
15
+ const normalized = channel?.trim().toLowerCase();
16
+ return normalized === "nightly" ? "Nightly" : normalized === "latest" ? "Latest" : null;
17
+}
18
+
19
+/** Stage label of a web build. vite.config.ts stamps it into index.html's title too. */
20
+export function resolveWebAppStageLabel(input: {
21
+ readonly hostedAppChannel: string | null | undefined;
22
+ readonly development: boolean;
23
+}): string {
24
+ return (
25
+ resolveHostedAppChannelLabel(input.hostedAppChannel) ?? (input.development ? "Dev" : "Beta")
26
+ );
27
+}
28
+
29
export function resolveServerBackedAppStageLabel(input: {
30
readonly primaryServerVersion: string | null | undefined;
31
readonly fallbackStageLabel: string;
@@ -36,3 +51,23 @@ export function resolveServerBackedAppDisplayName(input: {
51
? input.fallbackDisplayName
52
: formatAppDisplayName({ baseName: input.baseName, stageLabel });
53
}
54
+
55
+/**
56
+ * Names the open thread: `project / thread` on desktop, where the OS already
57
+ * shows the app, with the app name appended in browser tabs.
58
+ */
59
+export function resolveWindowTitle(input: {
60
+ readonly appDisplayName: string;
61
+ readonly projectTitle: string | null;
62
+ readonly threadTitle: string | null;
63
+ readonly desktop: boolean;
64
+}): string {
65
+ const threadTitle = input.threadTitle?.trim() ?? "";
66
+ if (threadTitle === "") {
67
+ return input.appDisplayName;
68
+ }
69
+
70
+ const projectTitle = input.projectTitle?.trim() ?? "";
71
+ const context = projectTitle === "" ? threadTitle : `${projectTitle} / ${threadTitle}`;
72
+ return input.desktop ? context : `${context} - ${input.appDisplayName}`;
73
+}
apps/web/src/branding.ts
+10
-5
@@ -1,5 +1,9 @@
1
import type { DesktopAppBranding } from "@t3tools/contracts";
2
-import { formatAppDisplayName } from "./branding.logic";
2
+import {
3
+ formatAppDisplayName,
4
+ resolveHostedAppChannelLabel,
5
+ resolveWebAppStageLabel,
6
+} from "./branding.logic";
7
8
function readInjectedDesktopAppBranding(): DesktopAppBranding | null {
9
if (typeof window === "undefined") {
@@ -14,13 +18,14 @@ const hostedAppChannel = import.meta.env.VITE_HOSTED_APP_CHANNEL?.trim().toLower
18
19
export const HOSTED_APP_CHANNEL =
20
hostedAppChannel === "latest" || hostedAppChannel === "nightly" ? hostedAppChannel : null;
17
-export const HOSTED_APP_CHANNEL_LABEL =
18
- HOSTED_APP_CHANNEL === "nightly" ? "Nightly" : HOSTED_APP_CHANNEL === "latest" ? "Latest" : null;
21
+export const HOSTED_APP_CHANNEL_LABEL = resolveHostedAppChannelLabel(HOSTED_APP_CHANNEL);
22
export const APP_BASE_NAME = injectedDesktopAppBranding?.baseName ?? "T3 Code";
23
export const APP_STAGE_LABEL =
24
injectedDesktopAppBranding?.stageLabel ??
22
- HOSTED_APP_CHANNEL_LABEL ??
23
- (import.meta.env.DEV ? "Dev" : "Beta");
25
+ resolveWebAppStageLabel({
26
+ hostedAppChannel: HOSTED_APP_CHANNEL,
27
+ development: import.meta.env.DEV,
28
+ });
29
export const APP_DISPLAY_NAME =
30
injectedDesktopAppBranding?.displayName ??
31
formatAppDisplayName({ baseName: APP_BASE_NAME, stageLabel: APP_STAGE_LABEL });
apps/web/vite.config.ts
+24
@@ -22,6 +22,7 @@ import { loadRepoEnv } from "../../scripts/lib/public-config";
22
import { thirdPartyLicensesPlugin } from "../../scripts/lib/third-party-licenses";
23
import { tailwindPlugins } from "./vite/tailwind";
24
import { warmBundledDevPlugin } from "./vite/warmBundledDev";
25
+import { formatAppDisplayName, resolveWebAppStageLabel } from "./src/branding.logic";
26
27
const repoEnv = loadRepoEnv();
28
Object.assign(process.env, repoEnv);
@@ -246,6 +247,28 @@ function chunkCycleGuardPlugin(): Plugin {
247
};
248
}
249
250
+// Stamps index.html's title with the name branding.ts resolves once the app
251
+// loads, so a tab opens on the right channel instead of flashing another's.
252
+// Desktop swaps in its injected branding from an inline script in index.html.
253
+function bootstrapTitlePlugin(): Plugin {
254
+ let development = false;
255
+ return {
256
+ name: "t3code:bootstrap-title",
257
+ configResolved(config) {
258
+ // The same flag Vite exposes to the app as import.meta.env.DEV.
259
+ development = !config.isProduction;
260
+ },
261
+ transformIndexHtml(html) {
262
+ const stageLabel = resolveWebAppStageLabel({
263
+ hostedAppChannel: configuredHostedAppChannel,
264
+ development,
265
+ });
266
+ const title = formatAppDisplayName({ baseName: "T3 Code", stageLabel });
267
+ return html.replace(/<title>[^<]*<\/title>/, `<title>${title}</title>`);
268
+ },
269
+ };
270
+}
271
+
272
// Allow Tailnet hosts for sharing; Tailscale-controlled DNS prevents attacker rebinding.
273
const configuredAllowedHosts = (process.env.T3CODE_DEV_ALLOWED_HOSTS ?? "")
274
.split(",")
@@ -266,6 +289,7 @@ export default defineConfig(() => {
289
},
290
assetsInclude: ["**/*.wasm"],
291
plugins: [
292
+ bootstrapTitlePlugin(),
293
devCompressionPlugin(),
294
chunkCycleGuardPlugin(),
295
builtDev