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

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

fix(server): a failed Git version probe no longer advises installing Git (#35638)

Julius Marminge committed Nov 12, 2026 at 14:49 UTC c544c2798188e9c81f904a38cb48dd3745f21c03
3 files changed +47 -30
apps/server/src/sourceControl/SourceControlDiscovery.test.ts
+14 -6
@@ -175,7 +175,7 @@ it.effect("reports every hosting integration in registry order with its sign-in"
175 }).pipe(Effect.provide(SourceControlDiscovery.layer.pipe(Layer.provide(layerDiscovery())))),
176 );
177
178 -it.effect("explains a hosting CLI whose version probe failed instead of advising an install", () =>
178 +it.effect("explains a CLI whose version probe failed instead of advising an install", () =>
179 Effect.gen(function* () {
180 const discovery = yield* SourceControlDiscovery.SourceControlDiscovery;
181 const result = yield* discovery.discover;
@@ -195,15 +195,23 @@ it.effect("explains a hosting CLI whose version probe failed instead of advising
195 assert.strictEqual(authDetail("broken"), item("broken").installHint);
196
197 assert.strictEqual(item("absent").installHint, "Install absent.");
198 +
199 + const git = result.versionControlSystems.find((entry) => entry.kind === "git");
200 + assert.isDefined(git);
201 + assert.notInclude(git.installHint, "Install Git from");
202 + assert.include(git.installHint, "`git --version` exited with status 1");
203 }).pipe(
204 Effect.provide(
205 SourceControlDiscovery.layer.pipe(
206 Layer.provide(
202 - layerDiscovery(run, [
203 - cliDiscovery("slow", "slow-cli"),
204 - cliDiscovery("broken", "broken-cli"),
205 - cliDiscovery("absent", "absent-cli"),
206 - ]),
207 + layerDiscovery(
208 + (input) => run(input.command === "git" ? { ...input, command: "broken-cli" } : input),
209 + [
210 + cliDiscovery("slow", "slow-cli"),
211 + cliDiscovery("broken", "broken-cli"),
212 + cliDiscovery("absent", "absent-cli"),
213 + ],
214 + ),
215 ),
216 ),
217 ),
apps/server/src/sourceControl/SourceControlDiscovery.ts
+2 -2
@@ -15,8 +15,8 @@ import { refreshPathFromLoginShell } from "../os-jank.ts";
15 import * as VcsProcess from "../vcs/VcsProcess.ts";
16 import {
17 detailFromCause,
18 + failedProbeHint,
19 firstNonEmptyLine,
19 - unavailableInstallHint,
20 } from "@t3tools/source-control-core/server/discovery";
21 import * as SourceControlProviderRegistry from "./SourceControlProviderRegistry.ts";
22
@@ -119,7 +119,7 @@ export const make = Effect.gen(function* () {
119 ),
120 Effect.catch((cause) =>
121 Effect.gen(function* () {
122 - const installHint = yield* unavailableInstallHint(executable, input.installHint, cause);
122 + const installHint = yield* failedProbeHint(input, cause);
123 return {
124 kind: input.kind,
125 label: input.label,
packages/source-control-core/src/server/discovery.ts
+31 -22
@@ -195,17 +195,6 @@ function isCliRemoteRefinementSpec(
195 const isVcsProcessTimeoutError = Schema.is(VcsProcessTimeoutError);
196 const isVcsProcessExitError = Schema.is(VcsProcessExitError);
197
198 -/** An installed CLI whose version probe failed needs a repair, not install advice. */
199 -function probeFailureHint(spec: SourceControlCliDiscoverySpec, cause: unknown): string {
200 - const command = `\`${[spec.executable, ...spec.versionArgs].join(" ")}\``;
201 - const outcome = isVcsProcessTimeoutError(cause)
202 - ? `timed out after ${cause.timeoutMs}ms`
203 - : isVcsProcessExitError(cause)
204 - ? `exited with status ${cause.exitCode}`
205 - : "failed";
206 - return `${command} ${outcome}. Check the \`${spec.executable}\` that the server's PATH resolves.`;
207 -}
208 -
198 function probeCli(input: {
199 readonly spec: SourceControlCliDiscoverySpec;
200 readonly process: SourceControlHost.SourceControlHost["Service"]["process"];
@@ -238,22 +227,13 @@ function probeCli(input: {
227 ),
228 Effect.catch((cause) =>
229 Effect.gen(function* () {
241 - const hint = yield* unavailableInstallHint(
242 - input.spec.executable,
243 - input.spec.installHint,
244 - cause,
245 - );
230 return {
231 kind: input.spec.kind,
232 label: input.spec.label,
233 executable: input.spec.executable,
234 status: "missing" as const,
235 version: Option.none<string>(),
252 - // A wrong-CPU hint or an absent executable keeps its advice; other failures need repair.
253 - installHint:
254 - hint !== input.spec.installHint || isMissingExecutable(cause)
255 - ? hint
256 - : probeFailureHint(input.spec, cause),
236 + installHint: yield* failedProbeHint(input.spec, cause),
237 detail: detailFromCause(cause),
238 } satisfies DiscoveryProbeResult;
239 }),
@@ -361,7 +341,7 @@ export function isMissingExecutable(error: unknown): boolean {
341 // Intel-only `gh` on Apple Silicon without Rosetta.
342 const BAD_CPU_TYPE_ERRNO = -86;
343
364 -export const unavailableInstallHint = Effect.fn("discovery.unavailableInstallHint")(function* (
344 +const unavailableInstallHint = Effect.fn("discovery.unavailableInstallHint")(function* (
345 executable: string,
346 installHint: string,
347 cause: unknown,
@@ -382,6 +362,35 @@ export const unavailableInstallHint = Effect.fn("discovery.unavailableInstallHin
362 return `\`${path ?? executable}\` is built for another CPU architecture, so this ${architecture} machine cannot run it. Remove or replace it. ${installHint}`;
363 });
364
365 +/** An installed CLI whose version probe failed needs a repair, not install advice. */
366 +function probeFailureHint(
367 + probe: { readonly executable: string; readonly versionArgs: ReadonlyArray<string> },
368 + cause: unknown,
369 +): string {
370 + const command = `\`${[probe.executable, ...probe.versionArgs].join(" ")}\``;
371 + const outcome = isVcsProcessTimeoutError(cause)
372 + ? `timed out after ${cause.timeoutMs}ms`
373 + : isVcsProcessExitError(cause)
374 + ? `exited with status ${cause.exitCode}`
375 + : "failed";
376 + return `${command} ${outcome}. Check the \`${probe.executable}\` that the server's PATH resolves.`;
377 +}
378 +
379 +export const failedProbeHint = Effect.fn("discovery.failedProbeHint")(function* (
380 + probe: {
381 + readonly executable: string;
382 + readonly versionArgs: ReadonlyArray<string>;
383 + readonly installHint: string;
384 + },
385 + cause: unknown,
386 +) {
387 + const hint = yield* unavailableInstallHint(probe.executable, probe.installHint, cause);
388 + // A wrong-CPU hint or an absent executable keeps its advice; other failures need repair.
389 + return hint !== probe.installHint || isMissingExecutable(cause)
390 + ? hint
391 + : probeFailureHint(probe, cause);
392 +});
393 +
394 class UnknownRemoteUnanswered extends Schema.TaggedError<UnknownRemoteUnanswered>()(
395 "UnknownRemoteUnanswered",
396 {},