Skip to content

Commit dcbe9a6

Browse files
only21milclaude
andauthored
fix(server): tracked clones keep an explicit SSH protocol on fallback and Retry (#28365)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent f2527c2 commit dcbe9a6

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎apps/server/src/project/ProjectCloneTracker.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
OrchestrationDispatchCommandError,
55
ProjectId,
66
projectCloneProgressSummary,
7+
type SourceControlCloneProtocol,
78
SourceControlRepositoryError,
89
} from "@t3tools/contracts";
910
import * as Deferred from "effect/Deferred";
@@ -146,12 +147,12 @@ describe("ProjectCloneTracker", () => {
146147
});
147148

148149
it.effect("keeps a failed clone with git's own explanation and retries it", () => {
149-
let attempts = 0;
150+
const protocols: Array<SourceControlCloneProtocol | undefined> = [];
150151
const harness = makeHarness({
151152
clone: (input) =>
152153
Effect.suspend(() => {
153-
attempts += 1;
154-
return attempts === 1
154+
protocols.push(input.protocol);
155+
return protocols.length === 1
155156
? Effect.fail(
156157
new SourceControlRepositoryError({
157158
operation: "cloneRepository",
@@ -168,7 +169,7 @@ describe("ProjectCloneTracker", () => {
168169
});
169170
return Effect.gen(function* () {
170171
const tracker = yield* ProjectCloneTracker.ProjectCloneTracker;
171-
yield* tracker.start(startInput, harness.hooks);
172+
yield* tracker.start({ ...startInput, protocol: "ssh" }, harness.hooks);
172173
yield* Effect.yieldNow;
173174
const failed = yield* tracker.get(projectId);
174175
expect(failed).toMatchObject({ phase: "failed", error: "fatal: repository not found" });
@@ -177,7 +178,7 @@ describe("ProjectCloneTracker", () => {
177178
expect(harness.discarded).toEqual(["/workspace/t3code"]);
178179
yield* Effect.yieldNow;
179180
expect((yield* tracker.get(projectId))?.phase).toBe("done");
180-
expect(attempts).toBe(2);
181+
expect(protocols).toEqual(["ssh", "ssh"]);
181182
}).pipe(Effect.provide(harness.layer));
182183
});
183184

‎apps/server/src/project/ProjectCloneTracker.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type {
55
ProjectCloneStartInput,
66
ProjectCloneStartResult,
77
ProjectId,
8+
SourceControlCloneProtocol,
89
SourceControlRepositoryInfo,
910
} from "@t3tools/contracts";
1011
import {
@@ -85,6 +86,7 @@ interface TrackedClone {
8586
readonly cloneUrl: string;
8687
readonly destinationPath: string;
8788
readonly repository: SourceControlRepositoryInfo | null;
89+
readonly protocol: SourceControlCloneProtocol;
8890
};
8991
}
9092

@@ -216,7 +218,11 @@ export const make = Effect.gen(function* () {
216218
const pulses = yield* Queue.sliding<void>(1);
217219
yield* watchForStall(projectId, pulses).pipe(Effect.forkScoped);
218220
return yield* repositories.cloneRepository(
219-
{ remoteUrl: tracked.input.cloneUrl, destinationPath: tracked.input.destinationPath },
221+
{
222+
remoteUrl: tracked.input.cloneUrl,
223+
destinationPath: tracked.input.destinationPath,
224+
protocol: tracked.input.protocol,
225+
},
220226
{
221227
onProgress: (update) =>
222228
Queue.offer(pulses, undefined).pipe(Effect.andThen(progress(projectId, update))),
@@ -295,6 +301,7 @@ export const make = Effect.gen(function* () {
295301
cloneUrl: prepared.cloneUrl,
296302
destinationPath: prepared.destinationPath,
297303
repository: prepared.repository,
304+
protocol: input.protocol ?? "auto",
298305
},
299306
});
300307
return [true, next] as const;

0 commit comments

Comments
 (0)