@devries-cameron20 / t3code-1 / commits / 3430a77b1c
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): Linux startup no longer waits up to a minute on hostnamectl (#33068)

Zenco committed Nov 12, 2026 at 07:10 UTC 3430a77b1cc071c27a890adec07fe9e435e7be51
2 files changed +54
apps/server/src/environment/ServerEnvironmentLabel.test.ts new
+52
@@ -0,0 +1,52 @@
1 +import { assert, it } from "@effect/vitest";
2 +import * as HostProcess from "@t3tools/shared/HostProcess";
3 +import * as Effect from "effect/Effect";
4 +import * as Fiber from "effect/Fiber";
5 +import * as FileSystem from "effect/FileSystem";
6 +import * as Layer from "effect/Layer";
7 +import * as Sink from "effect/Sink";
8 +import * as Stream from "effect/Stream";
9 +import * as TestClock from "effect/testing/TestClock";
10 +import { ChildProcessSpawner } from "effect/process";
11 +
12 +import * as ProcessRunner from "../processRunner.ts";
13 +import { resolveServerEnvironmentLabel } from "./ServerEnvironmentLabel.ts";
14 +
15 +const neverExits = ChildProcessSpawner.make(() =>
16 + Effect.succeed(
17 + ChildProcessSpawner.makeHandle({
18 + pid: ChildProcessSpawner.ProcessId(1),
19 + exitCode: Effect.never,
20 + isRunning: Effect.succeed(true),
21 + kill: () => Effect.void,
22 + unref: Effect.succeed(Effect.void),
23 + stdin: Sink.drain,
24 + stdout: Stream.never,
25 + stderr: Stream.never,
26 + all: Stream.empty,
27 + getInputFd: () => Sink.drain,
28 + getOutputFd: () => Stream.empty,
29 + }),
30 + ),
31 +);
32 +
33 +it.effect("falls back to the hostname when hostnamectl never answers", () =>
34 + Effect.gen(function* () {
35 + // Without /etc/machine-info the label comes from hostnamectl, which waits on D-Bus.
36 + const label = yield* resolveServerEnvironmentLabel({ cwdBaseName: "project" }).pipe(
37 + Effect.provideService(HostProcess.Platform, "linux"),
38 + Effect.provideService(HostProcess.Hostname, "devbox"),
39 + Effect.provide(
40 + Layer.mergeAll(
41 + FileSystem.layerNoop({ exists: () => Effect.succeed(false) }),
42 + ProcessRunner.layer.pipe(
43 + Layer.provide(Layer.succeed(ChildProcessSpawner.ChildProcessSpawner, neverExits)),
44 + ),
45 + ),
46 + ),
47 + Effect.forkChild,
48 + );
49 + yield* TestClock.adjust("5 seconds");
50 + assert.equal(yield* Fiber.join(label), "devbox");
51 + }),
52 +);
apps/server/src/environment/ServerEnvironmentLabel.ts
+2
@@ -116,6 +116,8 @@ const runFriendlyLabelCommand = Effect.fn("runFriendlyLabelCommand")(function* (
116 .run({
117 command: input.command,
118 args: input.args,
119 + // Server startup waits on this; hostnamectl can block on D-Bus when hostnamed is down.
120 + timeout: "5 seconds",
121 timeoutBehavior: "timedOutResult",
122 })
123 .pipe(