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

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

fix(server): repos without a remote no longer record failed spans on status refresh (#32905)

Co-authored-by: ferhtgoldaraz <2060086+ferhtgoldaraz@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Fernando H-T Goldáraz committed Nov 10, 2026 at 12:42 UTC d1aeed249288585390dbac4fde5b54c35bd5fc06
2 files changed +60 -14
apps/server/src/vcs/GitVcsDriverCore.test.ts
+39
@@ -23,6 +23,7 @@ import * as Schema from "effect/Schema";
23 import * as Sink from "effect/Sink";
24 import * as Stream from "effect/Stream";
25 import * as TestClock from "effect/testing/TestClock";
26 +import * as Tracer from "effect/Tracer";
27 import { ChildProcess, ChildProcessSpawner, CommandLine } from "effect/process";
28
29 import {
@@ -4001,6 +4002,44 @@ it.layer(layerTest)("GitVcsDriver core integration", (it) => {
4002 }),
4003 );
4004
4005 + it.effect("records no failed span reading status of a repository without a remote", () =>
4006 + Effect.gen(function* () {
4007 + const cwd = yield* makeTmpDir();
4008 + yield* initRepoWithCommit(cwd);
4009 + yield* git(cwd, ["checkout", "-b", "feature"]);
4010 + const driver = yield* GitVcsDriver.GitVcsDriver;
4011 + const spans: Array<Tracer.NativeSpan> = [];
4012 + const tracer = Tracer.make({
4013 + span: (options) => {
4014 + const span = new Tracer.NativeSpan(options);
4015 + spans.push(span);
4016 + return span;
4017 + },
4018 + });
4019 + const traced = <A, E>(effect: Effect.Effect<A, E>) =>
4020 + Effect.gen(function* () {
4021 + spans.length = 0;
4022 + const exit = yield* effect.pipe(Effect.withTracer(tracer), Effect.exit);
4023 + const failedSpans = spans.flatMap((span) =>
4024 + span.status._tag === "Ended" && Exit.isFailure(span.status.exit) ? [span.name] : [],
4025 + );
4026 + return { exit, failedSpans };
4027 + });
4028 +
4029 + const status = yield* traced(driver.statusDetailsRemote(cwd));
4030 + assert.isTrue(Exit.isSuccess(status.exit));
4031 + assert.deepStrictEqual(status.failedSpans, []);
4032 +
4033 + // A caller that needs a remote still fails, in its own span.
4034 + const fetch = yield* traced(driver.fetchRefCommit({ cwd, ref: "refs/pull/1/head" }));
4035 + assert.include(
4036 + Exit.isFailure(fetch.exit) ? Cause.pretty(fetch.exit.cause) : "",
4037 + "No git remote is configured for this repository.",
4038 + );
4039 + assert.deepStrictEqual(fetch.failedSpans, ["GitVcsDriver.fetchRefCommit"]);
4040 + }),
4041 + );
4042 +
4043 it.effect("can read cached remote divergence without fetching upstream", () =>
4044 Effect.gen(function* () {
4045 const cwd = yield* makeTmpDir();
apps/server/src/vcs/GitVcsDriverCore.ts
+21 -14
@@ -1744,25 +1744,32 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
1744 return parsedRemoteRef?.branchName ?? branchName;
1745 });
1746
1747 - const resolvePrimaryRemoteName = Effect.fn("resolvePrimaryRemoteName")(function* (cwd: string) {
1747 + // Local-only repositories are normal and status polls them, so the span succeeds with null.
1748 + // Callers that need a remote fail in their own span.
1749 + const findPrimaryRemoteName = Effect.fn("resolvePrimaryRemoteName")(function* (cwd: string) {
1750 if (yield* originRemoteExists(cwd)) {
1751 return "origin";
1752 }
1751 - const remotes = yield* listRemoteNames(cwd);
1752 - const [firstRemote] = remotes;
1753 - if (firstRemote) {
1754 - return firstRemote;
1755 - }
1756 - return yield* new GitCommandError({
1757 - ...gitCommandContext({
1758 - operation: "GitVcsDriver.resolvePrimaryRemoteName",
1759 - cwd,
1760 - args: ["remote"],
1761 - }),
1762 - detail: "No git remote is configured for this repository.",
1763 - });
1753 + const [firstRemote] = yield* listRemoteNames(cwd);
1754 + return firstRemote ?? null;
1755 });
1756
1757 + const resolvePrimaryRemoteName = (cwd: string) =>
1758 + findPrimaryRemoteName(cwd).pipe(
1759 + Effect.filterOrFail(
1760 + (remoteName): remoteName is string => remoteName !== null,
1761 + () =>
1762 + new GitCommandError({
1763 + ...gitCommandContext({
1764 + operation: "GitVcsDriver.resolvePrimaryRemoteName",
1765 + cwd,
1766 + args: ["remote"],
1767 + }),
1768 + detail: "No git remote is configured for this repository.",
1769 + }),
1770 + ),
1771 + );
1772 +
1773 const resolvePushRemoteName = Effect.fn("resolvePushRemoteName")(function* (
1774 cwd: string,
1775 refName: string,