@devries-cameron20 / t3code Mirror · read-only / commits / 68682fb5cf
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 22, 23:15 UTC

fix(web): show ready device host warnings (#19975)

Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>

Luís Miguel committed Oct 20, 2026 at 06:05 UTC 68682fb5cf0559c8751823210771bf83e4b3b9e7
4 files changed +107 -7
apps/web/src/components/device/DeviceSetup.test.ts
+38 -1
@@ -1,7 +1,7 @@
1 import type { DeviceServiceState } from "@t3tools/contracts";
2 import { describe, expect, it } from "vite-plus/test";
3
4 -import { deviceHubReadiness, platformSetupStatus } from "./DeviceSetup";
4 +import { deviceHostDiagnostics, deviceHubReadiness, platformSetupStatus } from "./DeviceSetup";
5
6 const deviceState = (overrides: Partial<DeviceServiceState> = {}): DeviceServiceState => ({
7 hosts: [
@@ -106,4 +106,41 @@ describe("device setup guidance", () => {
106 });
107 expect(platformSetupStatus(state, "android").ready).toBe(false);
108 });
109 +
110 + it("labels ready host warnings in host order and drops them once cleared", () => {
111 + const hosts = [
112 + { id: "local", label: "This machine" },
113 + { id: "macmini", label: "Mac Mini" },
114 + ];
115 + const state = deviceState({
116 + hostStatuses: {
117 + macmini: { status: "ready", detail: "adb is not on PATH." },
118 + local: { status: "ready", detail: "Xcode license not accepted." },
119 + },
120 + });
121 + expect(deviceHostDiagnostics(hosts, state.hostStatuses)).toEqual([
122 + { hostId: "local", label: "This machine", detail: "Xcode license not accepted." },
123 + { hostId: "macmini", label: "Mac Mini", detail: "adb is not on PATH." },
124 + ]);
125 + expect(
126 + deviceHostDiagnostics(hosts, {
127 + ...state.hostStatuses,
128 + local: { status: "ready" },
129 + }),
130 + ).toEqual([{ hostId: "macmini", label: "Mac Mini", detail: "adb is not on PATH." }]);
131 + });
132 +
133 + it("omits details from hosts that are not ready or not listed", () => {
134 + const hosts = [
135 + { id: "local", label: "This machine" },
136 + { id: "macmini", label: "Mac Mini" },
137 + ];
138 + expect(
139 + deviceHostDiagnostics(hosts, {
140 + local: { status: "failed", detail: "Device hub crashed." },
141 + macmini: { status: "starting", detail: "Connecting over SSH." },
142 + unknown: { status: "ready", detail: "Stale host warning." },
143 + }),
144 + ).toEqual([]);
145 + });
146 });
apps/web/src/components/device/DeviceSetup.tsx
+32
@@ -43,6 +43,37 @@ export function deviceHubReadiness(state: DeviceServiceState) {
43 return { ready, busy };
44 }
45
46 +/** A ready host keeps its devices usable but may still carry a discovery warning. */
47 +export function deviceHostDiagnostics(
48 + hosts: ReadonlyArray<Pick<DeviceServiceState["hosts"][number], "id" | "label">>,
49 + hostStatuses: DeviceServiceState["hostStatuses"],
50 +) {
51 + return hosts.flatMap((host) => {
52 + const status = hostStatuses[host.id];
53 + return status?.status === "ready" && status.detail
54 + ? [{ hostId: host.id, label: host.label, detail: status.detail }]
55 + : [];
56 + });
57 +}
58 +
59 +export function DeviceHostDiagnostics(props: {
60 + readonly hosts: ReadonlyArray<Pick<DeviceServiceState["hosts"][number], "id" | "label">>;
61 + readonly hostStatuses: DeviceServiceState["hostStatuses"];
62 + readonly className?: string;
63 +}) {
64 + const diagnostics = deviceHostDiagnostics(props.hosts, props.hostStatuses);
65 + if (diagnostics.length === 0) return null;
66 + return (
67 + <div role="status" className={cn("space-y-1 text-xs text-muted-foreground", props.className)}>
68 + {diagnostics.map(({ hostId, label, detail }) => (
69 + <p key={hostId} className="whitespace-pre-line break-words">
70 + {label}: {detail}
71 + </p>
72 + ))}
73 + </div>
74 + );
75 +}
76 +
77 export function platformSetupStatus(state: DeviceServiceState, platform: DevicePlatform) {
78 const hasDevices = state.devices.some((device) => device.platform === platform);
79 if (platform === "android" && !hasDevices && isAndroidDiscoveryUncertain(state)) {
@@ -277,6 +308,7 @@ function DevicePlatformSetup(props: {
308 <div className="space-y-3">
309 <PlatformStatus platform="iOS" status={platformSetupStatus(props.state, "ios")} />
310 <PlatformStatus platform="Android" status={platformSetupStatus(props.state, "android")} />
311 + <DeviceHostDiagnostics hosts={props.state.hosts} hostStatuses={props.state.hostStatuses} />
312 <p className="text-xs text-muted-foreground">
313 You can use either platform. Fixing a missing platform does not block the other one.
314 </p>
apps/web/src/components/settings/DeviceHostsSettings.tsx
+19
@@ -41,6 +41,7 @@ import { DeviceHostEditor } from "./DeviceHostEditor";
41 import { useHostConnectionChecks } from "./useHostConnectionChecks";
42 import { deviceHostConnectionKey } from "./deviceHostConnectionChecks";
43 import { settingsScopeEnvironmentLabel, settingsScopeEnvironmentLabels } from "./settingsScopeAxis";
44 +import { DeviceHostDiagnostics } from "../device/DeviceSetup";
45
46 export function DeviceHostsSettings(props: { environmentId: EnvironmentId | null }) {
47 const { scope, environments, connectedEnvironments } = useSettingsScope();
@@ -471,6 +472,12 @@ function DeviceHostList({
472 {result.error}
473 </p>
474 ) : null}
475 + {result.state ? (
476 + <DeviceHostDiagnostics
477 + hosts={[result.host]}
478 + hostStatuses={result.state.hostStatuses}
479 + />
480 + ) : null}
481 {result.versions}
482 {result.check?.status === "local" ? (
483 <p className="text-xs text-muted-foreground">
@@ -504,6 +511,18 @@ function DeviceHostList({
511 </details>
512 </div>
513 ) : null}
514 + {!compact
515 + ? results.map((result) =>
516 + result.state ? (
517 + <DeviceHostDiagnostics
518 + key={result.environmentId}
519 + className="mt-1"
520 + hosts={[result.host]}
521 + hostStatuses={result.state.hostStatuses}
522 + />
523 + ) : null,
524 + )
525 + : null}
526 </div>
527 {!compact && progress ? (
528 <span
apps/web/src/components/settings/IntegrationsSettings.tsx
+18 -6
@@ -61,6 +61,7 @@ import {
61 platformSetupStatus,
62 deviceHubDescription,
63 agentDeviceDescription,
64 + DeviceHostDiagnostics,
65 } from "~/components/device/DeviceSetup";
66 import { isElectron } from "../../env";
67
@@ -991,12 +992,23 @@ export function DeviceIntegrationControls({
992 : undefined
993 }
994 status={
994 - <div className="flex flex-wrap gap-x-5 gap-y-2">
995 - <PlatformStatus compact platform="iOS" status={platformSetupStatus(state, "ios")} />
996 - <PlatformStatus
997 - compact
998 - platform="Android"
999 - status={platformSetupStatus(state, "android")}
995 + <div className="space-y-2">
996 + <div className="flex flex-wrap gap-x-5 gap-y-2">
997 + <PlatformStatus
998 + compact
999 + platform="iOS"
1000 + status={platformSetupStatus(state, "ios")}
1001 + />
1002 + <PlatformStatus
1003 + compact
1004 + platform="Android"
1005 + status={platformSetupStatus(state, "android")}
1006 + />
1007 + </div>
1008 + {/* Remote hosts report their own warnings in the device host list below. */}
1009 + <DeviceHostDiagnostics
1010 + hosts={state.hosts.filter((host) => host.kind === "local")}
1011 + hostStatuses={state.hostStatuses}
1012 />
1013 </div>
1014 }