@devries-cameron20 / t3code-1 / commits / fb4bf0722a
Fork 0

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

fix(server): provider update commands get no stdin, so one that reads it fails fast (#33974)

Nik committed Nov 12, 2026 at 00:16 UTC fb4bf0722a56e748b3a5158f6d6579deca2c403d
2 files changed +40
apps/server/src/provider/providerMaintenanceRunner.test.ts
+38
@@ -1,3 +1,4 @@
1 +import * as NodeServices from "@effect/platform-node/NodeServices";
2 import { describe, it, assert } from "@effect/vitest";
3 import {
4 ProviderDriverKind,
@@ -560,6 +561,43 @@ describe("providerMaintenanceRunner", () => {
561 );
562 });
563
564 + it.effect.skipIf(HostProcess.Platform.defaultValue() === "win32")(
565 + "runs the updater with no stdin, so a command that reads it cannot wait forever",
566 + () =>
567 + Effect.gen(function* () {
568 + const { registry } = yield* makeRegistry(baseProvider);
569 + const updater = yield* makeTestRunner({
570 + ...registry,
571 + getProviderMaintenanceCapabilitiesForInstance: (_instanceId, provider) =>
572 + Effect.succeed({
573 + ...lifecycleFor(provider),
574 + update: {
575 + command: "codex update",
576 + executable: "/bin/sh",
577 + // An open pipe here would block a CLI that reads stdin until the update times out.
578 + args: ["-c", "[ -c /dev/stdin ] || { echo 'stdin is an open pipe' >&2; exit 1; }"],
579 + lockKey: "codex-native",
580 + },
581 + }),
582 + });
583 +
584 + const result = yield* updater.updateProvider(CODEX_DRIVER);
585 + // The registry reports no new version, so a command that exits 0 ends as "unchanged".
586 + assert.strictEqual(
587 + result.providers[0]?.updateState?.message,
588 + "Update command completed, but T3 Code still detects an outdated provider version.",
589 + );
590 + }).pipe(
591 + Effect.provide(
592 + Layer.mergeAll(
593 + NodeServices.layer,
594 + layerNonWindowsPlatform,
595 + layerLatestVersionHttpClient("1.0.0"),
596 + ),
597 + ),
598 + ),
599 + );
600 +
601 it.effect("re-resolves ownership before running and executes the fresh command", () => {
602 const calls: Array<{ command: string; args: ReadonlyArray<string> }> = [];
603 const fresh: Array<boolean> = [];
apps/server/src/provider/providerMaintenanceRunner.ts
+2
@@ -123,6 +123,8 @@ const runProviderMaintenanceCommandWithSpawner = Effect.fn("ProviderMaintenanceR
123 .spawn(
124 ChildProcess.make(resolved.command, resolved.args, {
125 shell: resolved.shell,
126 + // Nothing answers an update command, so one that reads stdin must see EOF, not wait.
127 + stdin: "ignore",
128 ...env,
129 }),
130 )