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, 08:15 UTC
fix(server): device list warnings keep the hub's error detail (#25248)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Jackson Miller committed
Nov 1, 2026 at 15:56 UTC
4306e7794a8475f7a3da29c81fa165d10c3890d8
2 files changed
+72
-7
apps/server/src/device/DeviceHubOperations.ts
+21
-7
@@ -39,6 +39,21 @@ const HubActionResult = Schema.Struct({
39
),
40
});
41
42
+// Hub diagnostics can carry a whole stderr dump.
43
+const boundDiagnostics = (text: string) =>
44
+ text.length > 2_000 ? `${text.slice(0, 1_999)}…` : text;
45
+
46
+// The hub's `error` is a util.inspect of Node's exec error; the stack and the
47
+// inspected fields follow the first frame, so keep the lines before it.
48
+const errorHead = (error: string) => {
49
+ const lines = error.split(/\r?\n/);
50
+ const firstFrame = lines.findIndex((line) => /^\s+at /.test(line));
51
+ return (firstFrame === -1 ? lines : lines.slice(0, firstFrame))
52
+ .map((line) => line.trim())
53
+ .filter(Boolean)
54
+ .join(" ");
55
+};
56
+
57
const vendorPrefix = (platform: DevicePlatform) =>
58
platform === "ios" ? "/vendor/serve-sim" : "/vendor/serve-emu";
59
@@ -109,7 +124,11 @@ export const makeDeviceHubOperations = (options: {
124
/(?:^Error:\s*ENOENT:|\bcode:\s*['"]ENOENT['"])/.test(error.error ?? "")
125
),
126
);
112
- const details = warnings?.map((error) => error.message) ?? [];
127
+ const details =
128
+ warnings?.map((error) => {
129
+ const head = errorHead(error.error ?? "");
130
+ return boundDiagnostics(head ? `${error.message} ${head}` : error.message);
131
+ }) ?? [];
132
let androidDiscoveryIncomplete = false;
133
if (androidAvailable) {
134
const avds = yield* run("emulator", ["-list-avds"]);
@@ -167,12 +186,7 @@ export const makeDeviceHubOperations = (options: {
186
: /timed? out|timeout/i.test(diagnostics)
187
? "timeout"
188
: "launch_failed",
170
- ...(diagnostics
171
- ? {
172
- diagnostics:
173
- diagnostics.length > 2_000 ? `${diagnostics.slice(0, 1_999)}…` : diagnostics,
174
- }
175
- : {}),
189
+ ...(diagnostics ? { diagnostics: boundDiagnostics(diagnostics) } : {}),
190
cause: result,
191
});
192
}
apps/server/src/device/DeviceService.test.ts
+51
@@ -638,6 +638,57 @@ it.effect("hides Android discovery failures when the host has no Android SDK", (
638
}).pipe(Effect.scoped),
639
);
640
641
+// The hub reports `error` as a util.inspect of Node's exec error.
642
+const simctlMessage = "[apple-utils] Failed to run `xcrun simctl list devices --json`:";
643
+const simctlCause =
644
+ "An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=60): Unable to connect to CoreSimulatorService [xcrun shim fail mode]";
645
+const simctlError = `Error: Command failed: xcrun simctl list devices --json
646
+${simctlCause}
647
+
648
+ at genericNodeError (node:internal/errors:986:15)
649
+ at wrappedFn (node:internal/errors:540:14)
650
+ at ChildProcess.exithandler (node:child_process:417:12)
651
+ at ChildProcess._handle.onexit (node:internal/child_process:335:5) {
652
+ code: 1,
653
+ killed: false,
654
+ signal: null,
655
+ cmd: 'xcrun simctl list devices --json',
656
+ stdout: '',
657
+ stderr: '${simctlCause}\\n'
658
+}`;
659
+const avdmanager = "/Users/test/Library/Android/sdk/cmdline-tools/latest/bin/avdmanager";
660
+const avdmanagerError = `Error: spawn ${avdmanager} ENOENT
661
+ at ChildProcess._handle.onexit (node:internal/child_process:316:19)
662
+ at onErrorNT (node:internal/child_process:524:16) {
663
+ errno: -2,
664
+ code: 'ENOENT',
665
+ syscall: 'spawn ${avdmanager}',
666
+ path: '${avdmanager}',
667
+ spawnargs: [ 'list', 'avd' ],
668
+ cmd: '${avdmanager} list avd',
669
+ stdout: '',
670
+ stderr: ''
671
+}`;
672
+
673
+it.effect("keeps the cause from the hub's error in discovery warnings, without the stack", () =>
674
+ Effect.gen(function* () {
675
+ const { service, discoveryErrors } = yield* fixture();
676
+ yield* Ref.set(discoveryErrors, [
677
+ { message: simctlMessage, error: simctlError },
678
+ { message: "[android-utils] Failed to run `avdmanager list avd`:", error: avdmanagerError },
679
+ ]);
680
+ const state = yield* service.configure({ enabled: true });
681
+ expect(state.hostStatusDetail).toBe(
682
+ [
683
+ `${simctlMessage} Error: Command failed: xcrun simctl list devices --json ${simctlCause}`,
684
+ `[android-utils] Failed to run \`avdmanager list avd\`: Error: spawn ${avdmanager} ENOENT`,
685
+ ].join("\n"),
686
+ );
687
+ expect(state.hostStatusDetail).not.toContain(" at ");
688
+ expect(state.hostStatusDetail).not.toContain("stderr:");
689
+ }).pipe(Effect.scoped),
690
+);
691
+
692
it.effect.each([
693
{
694
diagnostic: "Insufficient disk space at /private/user/path",