Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
fix(server): skip Linux libc detection on Windows/macOS (#5354)
bkntr1fa315ea93f2
diff --git a/apps/server/src/resourceTelemetry/ResourceMonitorBinary.test.ts b/apps/server/src/resourceTelemetry/ResourceMonitorBinary.test.tsindex 4c3afa97a..243556b6e 100644--- a/apps/server/src/resourceTelemetry/ResourceMonitorBinary.test.ts+++ b/apps/server/src/resourceTelemetry/ResourceMonitorBinary.test.ts@@ -4,7 +4,7 @@ import {HostProcessEnvironment,HostProcessPlatform,} from "@t3tools/shared/hostProcess";-import { assert, describe, it } from "@effect/vitest";+import { afterEach, assert, describe, expect, it, vi } from "@effect/vitest";import * as Effect from "effect/Effect";import * as FileSystem from "effect/FileSystem";@@ -12,6 +12,36 @@ import { ServerConfig } from "../config.ts";import * as ResourceMonitorBinary from "./ResourceMonitorBinary.ts";describe("ResourceMonitorBinary", () => {+ afterEach(() => {+ vi.restoreAllMocks();+ });++ it.effect("skips Linux libc detection on Windows", () =>+ Effect.gen(function* () {+ const getReport = vi.spyOn(process.report, "getReport").mockImplementation(() => {+ throw new Error("Linux libc detection must not run on Windows");+ });+ const fileSystem = yield* FileSystem.FileSystem;+ const baseDir = yield* fileSystem.makeTempDirectoryScoped({+ prefix: "t3-resource-monitor-binary-",+ });+ const binaryPath = `${baseDir}/t3-resource-monitor.exe`;+ yield* fileSystem.writeFileString(binaryPath, "binary");++ const service = yield* ResourceMonitorBinary.make().pipe(+ Effect.provide(ServerConfig.layerTest(process.cwd(), baseDir)),+ Effect.provideService(HostProcessPlatform, "win32"),+ Effect.provideService(HostProcessArchitecture, "arm64"),+ Effect.provideService(HostProcessEnvironment, {+ T3CODE_RESOURCE_MONITOR_PATH: binaryPath,+ }),+ );++ assert.equal(yield* service.resolve, binaryPath);+ expect(getReport).not.toHaveBeenCalled();+ }).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),+ );+it.effect("resolves an executable override", () =>Effect.gen(function* () {const fileSystem = yield* FileSystem.FileSystem;diff --git a/apps/server/src/resourceTelemetry/ResourceMonitorBinary.ts b/apps/server/src/resourceTelemetry/ResourceMonitorBinary.tsindex 1f14df518..c93bc54a1 100644--- a/apps/server/src/resourceTelemetry/ResourceMonitorBinary.ts+++ b/apps/server/src/resourceTelemetry/ResourceMonitorBinary.ts@@ -106,7 +106,7 @@ export function resourceMonitorPlatformKey(export function resourceMonitorRustTarget(platform: NodeJS.Platform,architecture: NodeJS.Architecture,- linuxLibc: ResourceMonitorLinuxLibc,+ linuxLibc?: ResourceMonitorLinuxLibc,): string | undefined {if (platform === "darwin") {return architecture === "arm64"@@ -142,7 +142,7 @@ export const make = Effect.fn("resourceTelemetry.resourceMonitorBinary.make")(fuconst platform = yield* HostProcessPlatform;const architecture = yield* HostProcessArchitecture;const environment = yield* HostProcessEnvironment;- const linuxLibc = yield* ResourceMonitorHostLinuxLibc;+ const linuxLibc = platform === "linux" ? yield* ResourceMonitorHostLinuxLibc : undefined;const executableName = binaryName(platform);const platformKey = resourceMonitorPlatformKey(platform, architecture);const rustTarget = resourceMonitorRustTarget(platform, architecture, linuxLibc);