From 057b369f991959bcaa4b0b181e8256739939cc9e Mon Sep 17 00:00:00 2001 From: Murat Aslan Date: Sun, 22 Mar 2026 03:16:37 +0300 Subject: [PATCH] fix(checkpointing): skip checkpoint when cwd is the home directory Running from ~/ causes git add -A to scan the entire home directory (Applications, .npm, .cache, etc.), exceeding the 30s timeout and crashing the checkpoint system. Skip checkpointing with a descriptive error when the resolved cwd matches the user's home directory. Fixes #1227 --- .../src/checkpointing/Layers/CheckpointStore.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/server/src/checkpointing/Layers/CheckpointStore.ts b/apps/server/src/checkpointing/Layers/CheckpointStore.ts index fac183ff7a..fb9c44fbfe 100644 --- a/apps/server/src/checkpointing/Layers/CheckpointStore.ts +++ b/apps/server/src/checkpointing/Layers/CheckpointStore.ts @@ -10,6 +10,7 @@ * @module CheckpointStoreLive */ import { randomUUID } from "node:crypto"; +import { homedir } from "node:os"; import { Effect, Layer, FileSystem, Path } from "effect"; @@ -91,6 +92,19 @@ const makeCheckpointStore = Effect.gen(function* () { Effect.gen(function* () { const operation = "CheckpointStore.captureCheckpoint"; + // Skip checkpointing for the home directory — git add -A on ~/ scans + // thousands of unrelated files and will time out. + const resolvedCwd = yield* Effect.try(() => path.resolve(input.cwd)); + const home = yield* Effect.try(() => homedir()); + if (resolvedCwd === home) { + return yield* new CheckpointInvariantError({ + operation, + detail: + "Skipping checkpoint: working directory is the home directory. " + + "Please open a specific project folder instead.", + }); + } + yield* Effect.acquireUseRelease( fs.makeTempDirectory({ prefix: "t3-fs-checkpoint-" }), (tempDir) =>