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 24, 17:45 UTC
fix(server): skip Linux libc detection on Windows/macOS (#5354)
bkntr committed
Aug 11, 2026 at 09:03 UTC
1fa315ea93f24e6f72455e234fa84a97de28492b
2 files changed
+33
-3
apps/server/src/resourceTelemetry/ResourceMonitorBinary.test.ts
+31
-1
@@ -4,7 +4,7 @@ import {
4
HostProcessEnvironment,
5
HostProcessPlatform,
6
} from "@t3tools/shared/hostProcess";
7
-import { assert, describe, it } from "@effect/vitest";
7
+import { afterEach, assert, describe, expect, it, vi } from "@effect/vitest";
8
import * as Effect from "effect/Effect";
9
import * as FileSystem from "effect/FileSystem";
10
@@ -12,6 +12,36 @@ import { ServerConfig } from "../config.ts";
12
import * as ResourceMonitorBinary from "./ResourceMonitorBinary.ts";
13
14
describe("ResourceMonitorBinary", () => {
15
+ afterEach(() => {
16
+ vi.restoreAllMocks();
17
+ });
18
+
19
+ it.effect("skips Linux libc detection on Windows", () =>
20
+ Effect.gen(function* () {
21
+ const getReport = vi.spyOn(process.report, "getReport").mockImplementation(() => {
22
+ throw new Error("Linux libc detection must not run on Windows");
23
+ });
24
+ const fileSystem = yield* FileSystem.FileSystem;
25
+ const baseDir = yield* fileSystem.makeTempDirectoryScoped({
26
+ prefix: "t3-resource-monitor-binary-",
27
+ });
28
+ const binaryPath = `${baseDir}/t3-resource-monitor.exe`;
29
+ yield* fileSystem.writeFileString(binaryPath, "binary");
30
+
31
+ const service = yield* ResourceMonitorBinary.make().pipe(
32
+ Effect.provide(ServerConfig.layerTest(process.cwd(), baseDir)),
33
+ Effect.provideService(HostProcessPlatform, "win32"),
34
+ Effect.provideService(HostProcessArchitecture, "arm64"),
35
+ Effect.provideService(HostProcessEnvironment, {
36
+ T3CODE_RESOURCE_MONITOR_PATH: binaryPath,
37
+ }),
38
+ );
39
+
40
+ assert.equal(yield* service.resolve, binaryPath);
41
+ expect(getReport).not.toHaveBeenCalled();
42
+ }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
43
+ );
44
+
45
it.effect("resolves an executable override", () =>
46
Effect.gen(function* () {
47
const fileSystem = yield* FileSystem.FileSystem;
apps/server/src/resourceTelemetry/ResourceMonitorBinary.ts
+2
-2
@@ -106,7 +106,7 @@ export function resourceMonitorPlatformKey(
106
export function resourceMonitorRustTarget(
107
platform: NodeJS.Platform,
108
architecture: NodeJS.Architecture,
109
- linuxLibc: ResourceMonitorLinuxLibc,
109
+ linuxLibc?: ResourceMonitorLinuxLibc,
110
): string | undefined {
111
if (platform === "darwin") {
112
return architecture === "arm64"
@@ -142,7 +142,7 @@ export const make = Effect.fn("resourceTelemetry.resourceMonitorBinary.make")(fu
142
const platform = yield* HostProcessPlatform;
143
const architecture = yield* HostProcessArchitecture;
144
const environment = yield* HostProcessEnvironment;
145
- const linuxLibc = yield* ResourceMonitorHostLinuxLibc;
145
+ const linuxLibc = platform === "linux" ? yield* ResourceMonitorHostLinuxLibc : undefined;
146
const executableName = binaryName(platform);
147
const platformKey = resourceMonitorPlatformKey(platform, architecture);
148
const rustTarget = resourceMonitorRustTarget(platform, architecture, linuxLibc);