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

fix(web): device setup lets you through with only a remote device host (#20077)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 15, 2026 at 17:07 UTC d10969557eabfef50bc395b3e2b84f3068649247
4 files changed +98 -30
apps/web/src/components/device/DevicePanel.tsx
+2 -7
@@ -20,7 +20,7 @@ import { deviceEnvironment, useDeviceState } from "~/state/device";
20 import { formatEnvironmentQueryError } from "~/state/query";
21 import { useAtomCommand } from "~/state/use-atom-command";
22 import { DeviceLoadingView } from "./DeviceLoadingView";
23 -import { DeviceSetup } from "./DeviceSetup";
23 +import { DeviceSetup, deviceHubReadiness } from "./DeviceSetup";
24 import { DeviceWorkspace } from "./DeviceWorkspace";
25 import { PreviewPanelShell, type PreviewPanelMode } from "../preview/PreviewPanelShell";
26
@@ -138,12 +138,7 @@ export function DevicePanel(props: {
138
139 const bootingDevices =
140 state.bootingDevices?.filter((device) => device.threadId === threadId) ?? [];
141 - const hostReady = Object.values(state.hostStatuses).some((host) => host.status === "ready");
142 - const hostBusy =
143 - !hostReady &&
144 - Object.values(state.hostStatuses).some(
145 - (host) => host.status === "installing" || host.status === "starting",
146 - );
141 + const { ready: hostReady, busy: hostBusy } = deviceHubReadiness(state);
142 const unavailablePlatforms = state.hosts.flatMap((host) =>
143 host.platforms
144 .filter((platform) => !platform.available)
apps/web/src/components/device/DeviceSetup.tsx
+48 -20
@@ -3,7 +3,7 @@ import type { DevicePlatform, DeviceServiceState, EnvironmentId } from "@t3tools
3 import { Check } from "lucide-react";
4 import { Check as CheckGlyph, CircleAlert } from "lucide";
5 import { AuthSettingsWriteScope } from "@t3tools/contracts";
6 -import { useState } from "react";
6 +import { useEffect, useState } from "react";
7
8 import { Button } from "~/components/ui/button";
9 import { DialogClose } from "~/components/ui/dialog";
@@ -23,20 +23,42 @@ export const deviceHubDescription =
23 export const agentDeviceDescription =
24 "Allow new agent sessions in this environment to start and control local and remote devices, with required tools set up automatically.";
25
26 +/**
27 + * `hostStatus` only tracks this machine. A machine without simulator tooling never
28 + * starts its own hub, so setup and the panel must also count remote device hosts.
29 + */
30 +export function deviceHubReadiness(state: DeviceServiceState) {
31 + const statuses = Object.values(state.hostStatuses).map((host) => host.status);
32 + const ready = state.hostStatus === "ready" || statuses.includes("ready");
33 + const busy =
34 + !ready &&
35 + [state.hostStatus, ...statuses].some(
36 + (status) => status === "installing" || status === "starting",
37 + );
38 + return { ready, busy };
39 +}
40 +
41 export function platformSetupStatus(state: DeviceServiceState, platform: DevicePlatform) {
27 - const availability = state.hosts
28 - .flatMap((host) => host.platforms)
29 - .find((candidate) => candidate.platform === platform);
30 - if (!availability?.available) {
42 + const availabilities = state.hosts.flatMap((host) =>
43 + host.platforms
44 + .filter((candidate) => candidate.platform === platform)
45 + .map((candidate) => ({ ...candidate, host })),
46 + );
47 + const supportingHosts = availabilities
48 + .filter((candidate) => candidate.available)
49 + .map((candidate) => candidate.host);
50 + if (supportingHosts.length === 0) {
51 return {
52 ready: false,
33 - message: availability?.reason ?? `${platformName(platform)} support was not detected.`,
53 + message: availabilities[0]?.reason ?? `${platformName(platform)} support was not detected.`,
54 };
55 }
36 - if (
37 - state.hostStatus === "ready" &&
38 - !state.devices.some((device) => device.platform === platform)
39 - ) {
56 + const readyHosts = supportingHosts.filter(
57 + (host) =>
58 + state.hostStatuses[host.id]?.status === "ready" ||
59 + (host.kind === "local" && state.hostStatus === "ready"),
60 + );
61 + if (readyHosts.length > 0 && !state.devices.some((device) => device.platform === platform)) {
62 return {
63 ready: false,
64 message:
@@ -45,12 +67,16 @@ export function platformSetupStatus(state: DeviceServiceState, platform: DeviceP
67 : "The Android SDK is installed, but no virtual device exists. Create one in Android Studio → Device Manager.",
68 };
69 }
70 + const remoteHost = supportingHosts.every((host) => host.kind !== "local")
71 + ? supportingHosts[0]
72 + : undefined;
73 + const location = remoteHost ? ` on ${remoteHost.label}` : "";
74 return {
75 ready: true,
76 message:
77 platform === "ios"
52 - ? "Xcode and iOS Simulator are available."
53 - : "The Android SDK and Emulator are available.",
78 + ? `Xcode and iOS Simulator are available${location}.`
79 + : `The Android SDK and Emulator are available${location}.`,
80 };
81 }
82
@@ -65,11 +91,16 @@ export function DeviceSetup(props: {
91 const [pending, setPending] = useState<"hub" | "check" | "agent" | "complete" | null>(null);
92 const [step, setStep] = useState(0);
93 const enabled = props.state.hostStatus !== "disabled";
68 - const busy = props.state.hostStatus === "installing" || props.state.hostStatus === "starting";
94 + const { ready, busy } = deviceHubReadiness(props.state);
95 const localPlatformsUnavailable = props.state.hosts.some(
96 (host) => host.kind === "local" && !host.platforms.some((platform) => platform.available),
97 );
98
99 + // Remote hosts report platforms only after a probe, like the Device panel's refresh on open.
100 + useEffect(() => {
101 + if (enabled) void list({ environmentId: props.environmentId, input: {} });
102 + }, [enabled, list, props.environmentId]);
103 +
104 const update = async (
105 kind: NonNullable<typeof pending>,
106 input: { enabled?: boolean; agentAccessEnabled?: boolean; onboardingCompleted?: boolean },
@@ -181,15 +212,12 @@ export function DeviceSetup(props: {
212 </Button>
213 )}
214 {step < 2 ? (
184 - <Button
185 - disabled={props.state.hostStatus !== "ready" || pending !== null}
186 - onClick={() => setStep(step + 1)}
187 - >
215 + <Button disabled={!ready || pending !== null} onClick={() => setStep(step + 1)}>
216 Continue
217 </Button>
218 ) : (
219 <Button
192 - disabled={!canConfigure || props.state.hostStatus !== "ready" || pending !== null}
220 + disabled={!canConfigure || !ready || pending !== null}
221 onClick={() => void update("complete", { onboardingCompleted: true })}
222 >
223 {pending === "complete" ? "Saving…" : "Done"}
@@ -209,7 +237,7 @@ export function DeviceHubSetupStatus({
237 readonly pending: boolean;
238 readonly compact?: boolean;
239 }) {
212 - if (!pending && state.hostStatus !== "ready") return null;
240 + if (!pending && !deviceHubReadiness(state).ready) return null;
241 return (
242 <p role="status" className="flex items-center gap-2 text-xs text-muted-foreground">
243 {pending ? <Spinner size="xs" /> : <Check className="size-3 text-success" />}
@@ -278,7 +306,7 @@ export function AgentDeviceSetupStatus(props: {
306 }
307 if (
308 props.state.agentAccessEnabled &&
281 - props.state.hostStatus === "ready" &&
309 + deviceHubReadiness(props.state).ready &&
310 props.state.hosts.some((host) => host.agentDeviceInstalled)
311 ) {
312 return (
apps/web/src/components/settings/IntegrationsSettings.test.tsx
+45 -1
@@ -68,7 +68,7 @@ vi.mock("./SettingsScopeContext", () => ({
68 }));
69
70 import { IntegrationsSettingsPanel } from "./IntegrationsSettings";
71 -import { platformSetupStatus } from "../device/DeviceSetup";
71 +import { deviceHubReadiness, platformSetupStatus } from "../device/DeviceSetup";
72
73 let renderer: ReactTestRenderer | undefined;
74
@@ -163,4 +163,48 @@ describe("device setup guidance", () => {
163 });
164 expect(platformSetupStatus(state, "android").message).toBe("Android Emulator is missing.");
165 });
166 +
167 + it("counts a remote device host when this machine has no simulator tooling", () => {
168 + const state = deviceState({
169 + hostStatus: "idle",
170 + hostStatuses: { macmini: { status: "ready" } },
171 + hosts: [
172 + {
173 + ...deviceState().hosts[0]!,
174 + platforms: [
175 + { platform: "ios", available: false, reason: "Xcode was not found." },
176 + { platform: "android", available: false, reason: "Android SDK was not found." },
177 + ],
178 + },
179 + {
180 + id: "macmini",
181 + kind: "ssh",
182 + label: "Mac Mini",
183 + hubInstalled: true,
184 + agentDeviceInstalled: true,
185 + platforms: [
186 + { platform: "ios", available: true },
187 + { platform: "android", available: false, reason: "Android SDK was not found." },
188 + ],
189 + },
190 + ],
191 + devices: [
192 + {
193 + hostId: "macmini",
194 + id: "iphone",
195 + platform: "ios",
196 + name: "iPhone 16 Pro",
197 + version: "iOS 27.0",
198 + booted: true,
199 + physical: false,
200 + },
201 + ],
202 + });
203 + expect(deviceHubReadiness(state).ready).toBe(true);
204 + expect(platformSetupStatus(state, "ios")).toEqual({
205 + ready: true,
206 + message: "Xcode and iOS Simulator are available on Mac Mini.",
207 + });
208 + expect(platformSetupStatus(state, "android").ready).toBe(false);
209 + });
210 });
apps/web/src/components/settings/IntegrationsSettings.tsx
+3 -2
@@ -58,6 +58,7 @@ import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime"
58 import {
59 AgentDeviceSetupStatus,
60 DeviceHubSetupStatus,
61 + deviceHubReadiness,
62 PlatformStatus,
63 platformSetupStatus,
64 deviceHubDescription,
@@ -691,7 +692,7 @@ function DeviceIntegrationControls({
692 const [pending, setPending] = useState<
693 "hub" | "check" | "agent" | "update-hub" | "update-agent" | null
694 >(null);
694 - const busy = state.hostStatus === "installing" || state.hostStatus === "starting";
695 + const { ready: hubReady, busy } = deviceHubReadiness(state);
696 const localPlatformsUnavailable = state.hosts.some(
697 (host) => host.kind === "local" && !host.platforms.some((platform) => platform.available),
698 );
@@ -701,7 +702,7 @@ function DeviceIntegrationControls({
702 if (
703 enabled &&
704 !platformsRevealed &&
704 - (state.hostStatus === "ready" || localPlatformsUnavailable) &&
705 + (hubReady || localPlatformsUnavailable) &&
706 pending !== "hub"
707 ) {
708 setPlatformsRevealed(true);