feat(web): clone repositories in the background instead of holding the palette open #11762
Mergedjuliusmarmingemerged 8 commits into
main fromrefs/pull/11762/headmerged by juliusmarminge View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- apps/server/src/ws.ts line 1643OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1614,3 +1628,16 @@16141628 observeRpcEffect(16151629 ORCHESTRATION_WS_METHODS.dispatchCommand,16161630 Effect.gen(function* () {1631+ // A project whose clone has not finished has no files to work1632+ // in. Web gates the composer on the clone stream; this keeps1633+ // older and other clients from starting a turn on an empty tree.1634+ // Checked before normalization so no attachment copies are made1635+ // for a command that is about to be refused.1636+ const cloningProjectId =1637+ command.type === "thread.create"1638+ ? command.projectId1639+ : command.type === "thread.turn.start"1640+ ? (command.bootstrap?.createThread?.projectId ?? null)1641+ : null;1642+ if (cloningProjectId !== null) {1643+ const clone = yield* projectCloneTracker.get(cloningProjectId);@@ -2093,3 +2098,15 @@20932098 () => (activeProject ? resolveProjectScripts(settings, activeProject) : []),20942099 [activeProject, settings],20952100 );2101+ // A project added by cloning exists before its files do. The draft stays2102+ // editable throughout; only sending waits for the clone, and a failed2103+ // clone offers its retry right where the user is looking.2104+ const activeProjectClone = useProjectClone(activeProjectRef);2105+ const cancelProjectClone = useAtomCommand(sourceControlEnvironment.cancelProjectClone, {2106+ reportFailure: false,2107+ });2108+ const retryProjectClone = useAtomCommand(sourceControlEnvironment.retryProjectClone, {2109+ reportFailure: false,2110+ });2111+ const removeClonedProject = useRemoveClonedProject();2112+ const projectCloneSendBlockReason =apps/server/src/project/ProjectCloneTracker.ts lines 362 to 364OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +344,21 @@344+ ...entry.snapshot,345+ phase: "running",346+ stage: "connecting",347+ percent: null,348+ detail: null,349+ error: null,350+ startedAt,351+ endedAt: null,352+ },353+ }));354+ yield* launch(projectId);355+ return true;356+ });357+358+ const discard: ProjectCloneTracker["Service"]["discard"] = (projectId) =>359+ Effect.gen(function* () {360+ const current = yield* Ref.get(clones);361+ const tracked = current.get(projectId);362+ if (!tracked) return;363+ if (tracked.fiber) yield* Fiber.interrupt(tracked.fiber);364+ if (tracked.snapshot.phase !== "done") {apps/server/src/ws.ts line 1637OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1614,3 +1628,10 @@16141628 observeRpcEffect(16151629 ORCHESTRATION_WS_METHODS.dispatchCommand,16161630 Effect.gen(function* () {1631+ // A project whose clone has not finished has no files to work1632+ // in. Web gates the composer on the clone stream; this keeps1633+ // older and other clients from starting a turn on an empty tree.1634+ // Checked before normalization so no attachment copies are made1635+ // for a command that is about to be refused.1636+ const cloningProjectId =1637+ command.type === "thread.create"apps/server/src/ws.ts line 1684OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1645,3 +1681,4 @@16451681 Effect.tapError(() => cleanupFailedUploadedAttachments(command, normalizedCommand)),16461682 );16471683 yield* recordClientCommandAnalytics(normalizedCommand);1684+ if (normalizedCommand.type === "project.delete") {apps/web/src/components/ProjectCloneToastCoordinator.tsx lines 169 to 169OutdatedResolvedby juliusmarminge@@ -0,0 +149,21 @@149+150+ // Failed or cancelled: the project stays, pointing at an empty folder.151+ // Retry from here; the draft's composer banner offers the same.152+ const cancelled = clone.phase === "cancelled";153+ const options = stackedThreadToast({154+ type: cancelled ? "info" : "error",155+ title: cancelled ? `Cancelled cloning ${name}` : `Failed to clone ${name}`,156+ description: cancelled ? clone.destinationPath : (clone.error ?? "The clone failed."),157+ timeout: 0,158+ actionProps: {159+ children: "Retry",160+ onClick: () => {161+ void retryClone({ environmentId, input: { projectId: clone.projectId } });162+ },163+ },164+ data: {165+ ...(cancelled ? { hideCopyButton: true } : {}),166+ secondaryActionProps: {167+ children: "Remove project",168+ onClick: () => {169+ closeToast();apps/server/src/sourceControl/SourceControlRepositoryService.ts line 239OutdatedResolvedby juliusmarminge@@ -194,14 +234,6 @@194234 });195235 }196236197- yield* git.execute({198- operation: "SourceControlRepositoryService.cloneRepository",199- cwd: preparedDestination.parentPath,200- args: ["clone", remoteUrl, preparedDestination.directoryName],201- timeoutMs: 120_000,202- maxOutputBytes: 256 * 1024,203- });204-205237 return {206- cwd: preparedDestination.destinationPath,238+ destinationPath: preparedDestination.destinationPath,207239 remoteUrl,apps/server/src/project/ProjectCloneTracker.ts line 369Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +318,21 @@318+ const after = yield* get(projectId);319+ // Git finished in the window before the interrupt landed: keep it.320+ if (after?.phase === "done") return;321+ if (after?.phase === "running") yield* finish(projectId, "cancelled", null);322+ // The partial checkout goes so a retry starts from an empty destination.323+ yield* repositories.discardClone(tracked.input.destinationPath).pipe(Effect.ignore);324+ }),325+ );326+ return true;327+ });328+329+ const retry: ProjectCloneTracker["Service"]["retry"] = (projectId) =>330+ Effect.gen(function* () {331+ const current = yield* Ref.get(clones);332+ const tracked = current.get(projectId);333+ if (334+ !tracked ||335+ (tracked.snapshot.phase !== "failed" && tracked.snapshot.phase !== "cancelled")336+ ) {337+ return false;338+ }@@ -2656,3 +2697,7 @@26562697 "rpc.aggregate": "source-control",26572698 },26582699 ),2700+ [WS_METHODS.projectCloneStart]: (input) =>2701+ observeRpcEffect(2702+ WS_METHODS.projectCloneStart,2703+ projectCloneTracker.start(input, {apps/web/src/hooks/useRemoveClonedProject.ts lines 34 to 34OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +14,21 @@14+ * folder along with the project entry, so there is nothing to confirm: no15+ * threads exist yet and the draft is the only thing lost, which the user is16+ * looking at when they click.17+ */18+export function useRemoveClonedProject() {19+ const navigate = useNavigate();20+ const { draftId: routeDraftId } = useParams({ strict: false });21+ const deleteProject = useAtomCommand(projectEnvironment.delete, { reportFailure: false });22+23+ return useCallback(24+ async (projectRef: ScopedProjectRef) => {25+ const draftStore = useComposerDraftStore.getState();26+ const viewingDraft = routeDraftId27+ ? draftStore.getDraftSession(routeDraftId as DraftId)28+ : null;29+ const viewingThisProject =30+ viewingDraft?.environmentId === projectRef.environmentId &&31+ viewingDraft.projectId === projectRef.projectId;32+ const result = await deleteProject({33+ environmentId: projectRef.environmentId,34+ input: { projectId: projectRef.projectId, force: true },
- apps/server/src/sourceControl/SourceControlRepositoryService.ts lines 269 to 269OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -208,0 +249,21 @@249+ const onProgress = options?.onProgress;250+ // Git interleaves progress redraws with its real messages on stderr. The251+ // last non-progress lines are what explain a failure ("Repository not252+ // found", "Permission denied"), so keep them for the error detail.253+ const stderrTail: Array<string> = [];254+ const onStderrLine = (line: string) => {255+ const parsed = parseGitCloneProgressLine(line);256+ if (parsed) return onProgress ? onProgress(parsed) : Effect.void;257+ return Effect.sync(() => {258+ const trimmed = line.trim();259+ if (trimmed.length === 0 || trimmed.startsWith("Cloning into")) return;260+ stderrTail.push(trimmed);261+ if (stderrTail.length > 4) stderrTail.shift();262+ });263+ };264+ yield* git265+ .execute({266+ operation: "SourceControlRepositoryService.cloneRepository",267+ cwd: path.dirname(prepared.destinationPath),268+ args: ["clone", "--progress", prepared.remoteUrl, path.basename(prepared.destinationPath)],269+ timeoutMs: CLONE_TIMEOUT_MS,@@ -0,0 +31,21 @@31+ viewingDraft.projectId === projectRef.projectId;32+ const result = await deleteProject({33+ environmentId: projectRef.environmentId,34+ input: { projectId: projectRef.projectId, force: true },35+ });36+ if (result._tag === "Failure") {37+ const error = squashAtomCommandFailure(result);38+ toastManager.add(39+ stackedThreadToast({40+ type: "error",41+ title: "Failed to remove project",42+ description: error instanceof Error ? error.message : "An error occurred.",43+ }),44+ );45+ return false;46+ }47+ releaseProjectDraftUploads(projectRef);48+ const projectDraft = draftStore.getDraftThreadByProjectRef(projectRef);49+ if (projectDraft) draftStore.clearDraftThread(projectDraft.draftId);50+ draftStore.clearProjectDraftThreadId(projectRef);51+ if (viewingThisProject) void navigate({ to: "/", replace: true });apps/server/src/sourceControl/SourceControlRepositoryService.ts line 272OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -208,0 +252,21 @@252+ // found", "Permission denied"), so keep them for the error detail.253+ const stderrTail: Array<string> = [];254+ const onStderrLine = (line: string) => {255+ const parsed = parseGitCloneProgressLine(line);256+ if (parsed) return onProgress ? onProgress(parsed) : Effect.void;257+ return Effect.sync(() => {258+ const trimmed = line.trim();259+ if (trimmed.length === 0 || trimmed.startsWith("Cloning into")) return;260+ stderrTail.push(trimmed);261+ if (stderrTail.length > 4) stderrTail.shift();262+ });263+ };264+ yield* git265+ .execute({266+ operation: "SourceControlRepositoryService.cloneRepository",267+ cwd: path.dirname(prepared.destinationPath),268+ args: ["clone", "--progress", prepared.remoteUrl, path.basename(prepared.destinationPath)],269+ timeoutMs: CLONE_TIMEOUT_MS,270+ // Progress redraws add up on a slow multi-GB clone; the cap only271+ // bounds the buffered copy, and once hit it stops line callbacks too.272+ maxOutputBytes: 64 * 1024 * 1024,apps/server/src/project/ProjectCloneTracker.ts lines 339 to 339OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -0,0 +319,21 @@319+ // Git finished in the window before the interrupt landed: keep it.320+ if (after?.phase === "done") return;321+ if (after?.phase === "running") yield* finish(projectId, "cancelled", null);322+ // The partial checkout goes so a retry starts from an empty destination.323+ yield* repositories.discardClone(tracked.input.destinationPath).pipe(Effect.ignore);324+ }),325+ );326+ return true;327+ });328+329+ const retry: ProjectCloneTracker["Service"]["retry"] = (projectId) =>330+ Effect.gen(function* () {331+ const current = yield* Ref.get(clones);332+ const tracked = current.get(projectId);333+ if (334+ !tracked ||335+ (tracked.snapshot.phase !== "failed" && tracked.snapshot.phase !== "cancelled")336+ ) {337+ return false;338+ }339+ yield* repositories.discardClone(tracked.input.destinationPath).pipe(Effect.ignore);@@ -0,0 +9,21 @@9+const EMPTY_CLONES: ReadonlyArray<ProjectCloneSnapshot> = [];10+const EMPTY_CLONE_ATOM = Atom.make<ProjectCloneSnapshot | null>(null).pipe(11+ Atom.withLabel("web-project-clone:empty"),12+);13+14+/**15+ * Latest clone list an environment has streamed; empty until the subscription16+ * delivers, and never subscribed on servers that predate clone tracking.17+ */18+const environmentProjectClonesAtom = Atom.family((environmentId: EnvironmentId) =>19+ Atom.make((get): ReadonlyArray<ProjectCloneSnapshot> => {20+ const supported =21+ get(environmentServerConfigsAtom).get(environmentId)?.environment.capabilities22+ .projectCloneTracking === true;23+ if (!supported) return EMPTY_CLONES;24+ const result = get(sourceControlEnvironment.projectClones({ environmentId, input: {} }));25+ return Option.getOrElse(AsyncResult.value(result), () => EMPTY_CLONES);26+ }).pipe(Atom.withLabel(`web-project-clones:${environmentId}`)),27+);28+29+const projectCloneAtom = Atom.family((key: string) => {apps/server/src/sourceControl/SourceControlRepositoryService.ts lines 272 to 272OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -208,0 +252,21 @@252+ // found", "Permission denied"), so keep them for the error detail.253+ const stderrTail: Array<string> = [];254+ const onStderrLine = (line: string) => {255+ const parsed = parseGitCloneProgressLine(line);256+ if (parsed) return onProgress ? onProgress(parsed) : Effect.void;257+ return Effect.sync(() => {258+ const trimmed = line.trim();259+ if (trimmed.length === 0 || trimmed.startsWith("Cloning into")) return;260+ stderrTail.push(trimmed);261+ if (stderrTail.length > 4) stderrTail.shift();262+ });263+ };264+ yield* git265+ .execute({266+ operation: "SourceControlRepositoryService.cloneRepository",267+ cwd: path.dirname(prepared.destinationPath),268+ args: ["clone", "--progress", prepared.remoteUrl, path.basename(prepared.destinationPath)],269+ timeoutMs: CLONE_TIMEOUT_MS,270+ // Progress redraws add up on a slow multi-GB clone; the cap only271+ // bounds the buffered copy, and once hit it stops line callbacks too.272+ maxOutputBytes: 64 * 1024 * 1024,apps/web/src/routes/__root.tsx line 226OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -222,3 +223,4 @@222223 <ThreadNotificationCoordinator />223224 <ConfirmDialogHost />224225 <SlowRpcRequestToastCoordinator />226+ {primaryEnvironmentAuthenticated ? <ProjectCloneToastCoordinator /> : null}packages/client-runtime/src/state/sourceControl.ts lines 50 to 67Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -34,2 +35,21 @@3435 },3536 }),37+ // Clone-backed project creation. The RPC returns once the project exists38+ // and the clone runs in the background; `projectClones` carries progress.39+ startProjectClone: createEnvironmentRpcCommand(runtime, {40+ label: "environment-data:source-control:project-clone-start",41+ tag: WS_METHODS.projectCloneStart,42+ scheduler: commandScheduler,43+ concurrency: {44+ mode: "serial",45+ key: ({ environmentId }) => environmentId,46+ },47+ }),48+ cancelProjectClone: createEnvironmentRpcCommand(runtime, {49+ label: "environment-data:source-control:project-clone-cancel",50+ tag: WS_METHODS.projectCloneCancel,51+ }),52+ retryProjectClone: createEnvironmentRpcCommand(runtime, {53+ label: "environment-data:source-control:project-clone-retry",54+ tag: WS_METHODS.projectCloneRetry,55+ }),
- apps/server/src/server.test.ts lines 7337 to 7342Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -7132,0 +7204,21 @@7204+ },7205+ runtimeMode: "full-access",7206+ interactionMode: "default",7207+ branch: null,7208+ worktreePath: null,7209+ createdAt: "2026-01-01T00:00:01.000Z",7210+ }),7211+ );7212+ assert.include(String(blocked.message), "still being cloned");7213+7214+ const snapshots = yield* client[WS_METHODS.subscribeProjectClones]({}).pipe(7215+ Stream.takeUntil((clones) => clones[0]?.phase === "done"),7216+ Stream.runCollect,7217+ Effect.forkChild,7218+ );7219+ yield* Effect.yieldNow;7220+ yield* Deferred.succeed(cloneGate, undefined);7221+ const lists = yield* Fiber.join(snapshots);7222+ assert.equal(lists.at(-1)?.[0]?.phase, "done");7223+ // The finished clone refreshes the project so its repository identity updates.7224+ assert.deepEqual(dispatched, ["project.create", "project.meta.update"]);packages/contracts/src/projectClone.ts line 90OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +70,21 @@70+export type ProjectCloneStartInput = typeof ProjectCloneStartInput.Type;71+72+export const ProjectCloneStartResult = Schema.Struct({73+ projectId: ProjectId,74+ cwd: TrimmedNonEmptyString,75+ remoteUrl: TrimmedNonEmptyString,76+ repository: Schema.NullOr(SourceControlRepositoryInfo),77+});78+export type ProjectCloneStartResult = typeof ProjectCloneStartResult.Type;79+80+export const ProjectCloneActionInput = Schema.Struct({81+ projectId: ProjectId,82+});83+export type ProjectCloneActionInput = typeof ProjectCloneActionInput.Type;84+85+export const ProjectCloneActionResult = Schema.Struct({86+ applied: Schema.Boolean,87+});88+export type ProjectCloneActionResult = typeof ProjectCloneActionResult.Type;89+90+export function projectCloneStageLabel(stage: ProjectCloneStage): string {
- apps/server/src/vcs/GitVcsDriverCore.ts line 730OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -718,3 +725,6 @@718725 const decoded = decoder.decode(chunkToDecode, { stream: !truncated });719726 text += decoded;720727 lineBuffer += decoded;728+ if (truncated && keepLineCallbacksAfterTruncation && onLine) {729+ // The rest of this chunk still carries lines for the callbacks.730+ lineBuffer += lineDecoder.decode(chunk.subarray(chunkToDecode.byteLength), { stream: true });@@ -2656,3 +2675,7 @@26562675 "rpc.aggregate": "source-control",26572676 },26582677 ),2678+ [WS_METHODS.projectCloneStart]: (input) =>2679+ observeRpcEffect(2680+ WS_METHODS.projectCloneStart,2681+ projectCloneTracker.start(input, {apps/server/src/vcs/GitVcsDriverCore.ts line 826Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -802,10 +814,12 @@802814 maxOutputBytes,803815 appendTruncationMarker,804816 input.progress?.onStdoutLine,817+ input.keepLineCallbacksAfterTruncation,805818 ),806819 collectOutput(807820 commandInput,808821 child.stderr,809822 maxOutputBytes,810823 appendTruncationMarker,811824 input.progress?.onStderrLine,825+ input.keepLineCallbacksAfterTruncation,
- apps/server/src/project/ProjectCloneTracker.ts line 227OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -0,0 +207,21 @@207+ ...tracked.snapshot,208+ phase,209+ endedAt,210+ percent: phase === "done" ? 100 : tracked.snapshot.percent,211+ error: error === null ? null : clampText(error, PROJECT_CLONE_ERROR_MAX_LENGTH),212+ },213+ }));214+ if (phase === "done") yield* scheduleRemoval(projectId);215+ });216+217+ /**218+ * The clone body. Runs in its own fiber; the tracker records the outcome219+ * through `onExit`, which still runs when the fiber is interrupted (a220+ * `matchCause` handler would be skipped). Once git has finished the clone221+ * is marked done before the post-clone hook runs, so a late Cancel cannot222+ * tear down a complete checkout.223+ */224+ const runClone = (projectId: ProjectId, tracked: TrackedClone) =>225+ repositories226+ .cloneRepository(227+ { remoteUrl: tracked.input.remoteUrl, destinationPath: tracked.input.destinationPath },@@ -0,0 +299,21 @@299+ return [true, next] as const;300+ });301+ if (!claimed) {302+ return yield* new SourceControlRepositoryError({303+ operation: "cloneRepository",304+ provider: input.provider ?? "unknown",305+ detail: "A clone into this destination is already in progress.",306+ });307+ }308+ yield* clearRetention(input.projectId);309+ // The entry is registered before the project exists so a thread.create310+ // or project.delete racing this call already sees the clone. If the311+ // project cannot be created the entry goes away again.312+ yield* hooks313+ .createProject({314+ projectId: input.projectId,315+ title: input.title,316+ workspaceRoot: prepared.destinationPath,317+ createdAt: input.createdAt,318+ })319+ .pipe(Effect.tapError(() => remove(input.projectId)));apps/server/src/sourceControl/SourceControlRepositoryService.ts lines 275 to 276Resolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -194,14 +257,7 @@194257 });195258 }196259197- yield* git.execute({198- operation: "SourceControlRepositoryService.cloneRepository",199- cwd: preparedDestination.parentPath,200- args: ["clone", remoteUrl, preparedDestination.directoryName],201- timeoutMs: 120_000,202- maxOutputBytes: 256 * 1024,203- });204-205260 return {206- cwd: preparedDestination.destinationPath,207- remoteUrl,261+ destinationPath: preparedDestination.destinationPath,262+ remoteUrl: redactRemoteUrl(remoteUrl),263+ cloneUrl: remoteUrl,
- apps/server/src/sourceControl/SourceControlRepositoryService.ts line 373Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -209,0 +320,21 @@320+ : "The repository could not be cloned.",321+ cause,322+ }),323+ ),324+ );325+326+ return {327+ cwd: prepared.destinationPath,328+ remoteUrl: prepared.remoteUrl,329+ repository: prepared.repository,330+ };331+ });332+333+ const discardClone = Effect.fn("SourceControlRepositoryService.discardClone")(function* (334+ destinationPath: string,335+ ) {336+ const normalized = yield* normalizeDestinationPath(destinationPath);337+ // The directory itself is the project's workspace root and must stay;338+ // only git's partial contents go. An interrupted git may still be closing339+ // files, so removal retries briefly.340+ yield* fileSystem.remove(normalized, { recursive: true, force: true }).pipe(apps/server/src/sourceControl/SourceControlRepositoryService.ts lines 130 to 130OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -64,3 +110,21 @@64110 };65111 }66112113+/**114+ * The URL clients see. A pasted `https://user:token@host/…` must not travel115+ * back over `subscribeProjectClones` to every reader; git still gets the116+ * original.117+ */118+function redactRemoteUrl(remoteUrl: string): string {119+ try {120+ const url = new URL(remoteUrl);121+ if (url.username.length === 0 && url.password.length === 0) return remoteUrl;122+ url.username = "";123+ url.password = "";124+ return url.toString();125+ } catch {126+ return remoteUrl;127+ }128+}129+130+const URL_WITH_USERINFO = /\b([a-z][a-z0-9+.-]*:\/\/)[^\s/@]+@/gi;apps/server/src/sourceControl/SourceControlRepositoryService.ts lines 121 to 124OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -64,3 +110,15 @@64110 };65111 }66112113+/**114+ * The URL clients see. A pasted `https://user:token@host/…` must not travel115+ * back over `subscribeProjectClones` to every reader; git still gets the116+ * original.117+ */118+function redactRemoteUrl(remoteUrl: string): string {119+ try {120+ const url = new URL(remoteUrl);121+ if (url.username.length === 0 && url.password.length === 0) return remoteUrl;122+ url.username = "";123+ url.password = "";124+ return url.toString();
- apps/server/src/sourceControl/SourceControlRepositoryService.ts line 348OutdatedResolvedby coderabbitai[bot](GitHub profile, opens in a new tab)@@ -209,0 +328,21 @@328+ }),329+ ),330+ );331+332+ return {333+ cwd: prepared.destinationPath,334+ remoteUrl: prepared.remoteUrl,335+ repository: prepared.repository,336+ };337+ });338+339+ const discardClone = Effect.fn("SourceControlRepositoryService.discardClone")(function* (340+ destinationPath: string,341+ ) {342+ const normalized = yield* normalizeDestinationPath(destinationPath);343+ // Only what git left behind may go. The destination was empty when the344+ // clone started, so anything without a `.git` inside was put there by345+ // someone else since; refuse rather than delete their files.346+ const entries = yield* fileSystem347+ .readDirectory(normalized)348+ .pipe(Effect.orElseSucceed((): ReadonlyArray<string> => []));
- apps/web/src/components/ChatView.tsx line 2165OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2096,0 +2145,21 @@2145+ }2146+ const cancelled = activeProjectClone.phase === "cancelled";2147+ return {2148+ id: `project-clone:${projectId}`,2149+ variant: cancelled ? "warning" : "error",2150+ icon: <DownloadIcon />,2151+ title: cancelled ? `Cancelled cloning ${name}` : `Failed to clone ${name}`,2152+ description: cancelled ? "Retry to bring in the repository." : activeProjectClone.error,2153+ actions: (2154+ <>2155+ <Button2156+ size="xs"2157+ variant="ghost"2158+ onClick={() => void removeClonedProject({ environmentId, projectId })}2159+ >2160+ Remove project2161+ </Button>2162+ <Button2163+ size="xs"2164+ variant="ghost"2165+ onClick={() => void retryProjectClone({ environmentId, input: { projectId } })}
juliusmarminge merged this8d7c700
juliusmarminge closed this
Sign in to join this conversation.




Thread transfer impact#
✅ Thread transfer remains within every enforced ceiling.
Baseline:
f328db3· PR result:77a1919· Source CI: successScenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.