From f5b7b63ab4f192b541716597d90e378b49cd274f Mon Sep 17 00:00:00 2001 From: UtkarshUsername Date: Thu, 30 Jul 2026 20:09:30 +0530 Subject: [PATCH 1/7] fix(server): cache default branch name and origin existence across status refreshes --- apps/server/src/vcs/GitVcsDriverCore.ts | 46 ++++++++++++++++++------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts index 3aa7575d590..d6f9ec7995f 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.ts @@ -61,6 +61,8 @@ const LIST_REFS_SNAPSHOT_CACHE_CAPACITY = 64; const LIST_REFS_SNAPSHOT_CACHE_TTL = Duration.minutes(2); const LIST_REFS_REFRESH_COALESCE_TTL = Duration.seconds(5); const LIST_REFS_REFRESH_FAILURE_COOLDOWN = Duration.seconds(30); +const STATUS_DEFAULT_BRANCH_CACHE_TTL = Duration.minutes(5); +const STATUS_ORIGIN_EXISTS_CACHE_TTL = Duration.minutes(5); const STATUS_UPSTREAM_REFRESH_ENV = Object.freeze({ GCM_INTERACTIVE: "never", GIT_ASKPASS: "", @@ -1119,6 +1121,26 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* return Cache.get(refresh ? repositoryPathsRefreshCache : repositoryPathsCache, cacheKey); }; + const defaultBranchCache = yield* Cache.makeWith( + (cwd: string) => resolveDefaultBranchName(cwd, "origin").pipe(Effect.orElseSucceed(() => null)), + { + capacity: 2_048, + timeToLive: () => STATUS_DEFAULT_BRANCH_CACHE_TTL, + }, + ); + const originExistsCache = yield* Cache.makeWith( + (cwd: string) => originRemoteExists(cwd).pipe(Effect.orElseSucceed(() => false)), + { + capacity: 2_048, + timeToLive: () => STATUS_ORIGIN_EXISTS_CACHE_TTL, + }, + ); + const invalidateStatusStaticCaches = (cwd: string) => + Effect.gen(function* () { + yield* Cache.invalidate(defaultBranchCache, cwd); + yield* Cache.invalidate(originExistsCache, cwd); + }); + const resolveGitCommonDir = Effect.fn("resolveGitCommonDir")(function* (cwd: string) { const repositoryPaths = yield* resolveRepositoryPaths(cwd); if (repositoryPaths !== null) { @@ -1517,7 +1539,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* }); } - const [numstatStdout, defaultRefResult, hasPrimaryRemote] = yield* Effect.all( + const [numstatStdout, defaultBranch, hasPrimaryRemote] = yield* Effect.all( [ executeGitWithStableDiagnostics( "GitVcsDriver.statusDetails.numstat", @@ -1574,21 +1596,12 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* ); }), ), - executeGit( - "GitVcsDriver.statusDetails.defaultRef", - cwd, - ["symbolic-ref", "refs/remotes/origin/HEAD"], - { allowNonZeroExit: true }, - ), - originRemoteExists(cwd).pipe(Effect.orElseSucceed(() => false)), + Cache.get(defaultBranchCache, cwd), + Cache.get(originExistsCache, cwd), ], { concurrency: "unbounded" }, ); const statusStdout = statusResult.stdout; - const defaultBranch = - defaultRefResult.exitCode === 0 - ? defaultRefResult.stdout.trim().replace(/^refs\/remotes\/origin\//, "") - : null; let refName: string | null = null; let upstreamRef: string | null = null; @@ -2809,7 +2822,14 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* cwd: string, effect: Effect.Effect, ): Effect.Effect => - effect.pipe(Effect.ensuring(invalidateListRefsSnapshot(cwd).pipe(Effect.ignore))); + effect.pipe( + Effect.ensuring( + Effect.all([ + invalidateListRefsSnapshot(cwd).pipe(Effect.ignore), + invalidateStatusStaticCaches(cwd).pipe(Effect.ignore), + ]), + ), + ); const initRepoWithListRefsInvalidation: GitVcsDriver.GitVcsDriver["Service"]["initRepo"] = ( input, ) => From 5d1dee7e1679d4d84c9deaa2bfcae1f135e23744 Mon Sep 17 00:00:00 2001 From: UtkarshUsername Date: Thu, 30 Jul 2026 23:00:19 +0530 Subject: [PATCH 2/7] fix(server): normalize cache keys and add consistency test for stable lookup caches --- apps/server/src/vcs/GitVcsDriverCore.test.ts | 19 +++++++++++++++++++ apps/server/src/vcs/GitVcsDriverCore.ts | 10 ++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/apps/server/src/vcs/GitVcsDriverCore.test.ts b/apps/server/src/vcs/GitVcsDriverCore.test.ts index aab69de6a12..d9b816563c6 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.test.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.test.ts @@ -153,6 +153,25 @@ it.effect("uses stable diagnostics for every parsed non-repository command", () }).pipe(Effect.provide(layer)); }); +it.effect( + "returns consistent default branch and origin remote across repeated local status calls", + () => + Effect.gen(function* () { + const driver = yield* GitVcsDriver.GitVcsDriver; + const cwd = yield* makeTmpDir(); + const { initialBranch } = yield* initRepoWithCommit(cwd); + + const a = yield* driver.statusDetailsLocal(cwd); + const b = yield* driver.statusDetailsLocal(cwd); + + assert.equal(a.isRepo, true); + assert.equal(a.branch, initialBranch); + assert.equal(a.isDefaultBranch, b.isDefaultBranch); + assert.equal(a.hasOriginRemote, b.hasOriginRemote); + assert.equal(a.hasWorkingTreeChanges, false); + }).pipe(Effect.provide(TestLayer)), +); + it.effect("coalesces concurrent ref pages into one repository snapshot", () => Effect.scoped( Effect.gen(function* () { diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts index d6f9ec7995f..d716ad03576 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.ts @@ -1137,8 +1137,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* ); const invalidateStatusStaticCaches = (cwd: string) => Effect.gen(function* () { - yield* Cache.invalidate(defaultBranchCache, cwd); - yield* Cache.invalidate(originExistsCache, cwd); + const cacheKey = normalizeRepositoryPathsCacheKey(cwd); + yield* Cache.invalidate(defaultBranchCache, cacheKey); + yield* Cache.invalidate(originExistsCache, cacheKey); }); const resolveGitCommonDir = Effect.fn("resolveGitCommonDir")(function* (cwd: string) { @@ -1539,6 +1540,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* }); } + const statusCacheKey = normalizeRepositoryPathsCacheKey(cwd); const [numstatStdout, defaultBranch, hasPrimaryRemote] = yield* Effect.all( [ executeGitWithStableDiagnostics( @@ -1596,8 +1598,8 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* ); }), ), - Cache.get(defaultBranchCache, cwd), - Cache.get(originExistsCache, cwd), + Cache.get(defaultBranchCache, statusCacheKey), + Cache.get(originExistsCache, statusCacheKey), ], { concurrency: "unbounded" }, ); From bdc726e2a636c9afe1d4b4c4d7bda3eab75ae102 Mon Sep 17 00:00:00 2001 From: UtkarshUsername Date: Thu, 30 Jul 2026 23:37:29 +0530 Subject: [PATCH 3/7] fix(server): don't cache transient git failures in status lookups Move Effect.orElseSucceed from cache factory to call site so that transient git command failures (timeout, etc.) are not cached for 5 minutes. When the cache lookup fails, the error escapes, and orElseSucceed at the call site substitutes the fallback for that single call only. --- apps/server/src/vcs/GitVcsDriverCore.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts index d716ad03576..062ad6c8480 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.ts @@ -1122,19 +1122,16 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* }; const defaultBranchCache = yield* Cache.makeWith( - (cwd: string) => resolveDefaultBranchName(cwd, "origin").pipe(Effect.orElseSucceed(() => null)), + (cwd: string) => resolveDefaultBranchName(cwd, "origin"), { capacity: 2_048, timeToLive: () => STATUS_DEFAULT_BRANCH_CACHE_TTL, }, ); - const originExistsCache = yield* Cache.makeWith( - (cwd: string) => originRemoteExists(cwd).pipe(Effect.orElseSucceed(() => false)), - { - capacity: 2_048, - timeToLive: () => STATUS_ORIGIN_EXISTS_CACHE_TTL, - }, - ); + const originExistsCache = yield* Cache.makeWith((cwd: string) => originRemoteExists(cwd), { + capacity: 2_048, + timeToLive: () => STATUS_ORIGIN_EXISTS_CACHE_TTL, + }); const invalidateStatusStaticCaches = (cwd: string) => Effect.gen(function* () { const cacheKey = normalizeRepositoryPathsCacheKey(cwd); @@ -1598,8 +1595,8 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* ); }), ), - Cache.get(defaultBranchCache, statusCacheKey), - Cache.get(originExistsCache, statusCacheKey), + Cache.get(defaultBranchCache, statusCacheKey).pipe(Effect.orElseSucceed(() => null)), + Cache.get(originExistsCache, statusCacheKey).pipe(Effect.orElseSucceed(() => false)), ], { concurrency: "unbounded" }, ); From 396e9a7ecb73e0e81449f80272bf7682e5a22452 Mon Sep 17 00:00:00 2001 From: UtkarshUsername Date: Thu, 30 Jul 2026 23:40:22 +0530 Subject: [PATCH 4/7] test(server): verify status caches invalidate after driver mutation --- apps/server/src/vcs/GitVcsDriverCore.test.ts | 29 ++++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/apps/server/src/vcs/GitVcsDriverCore.test.ts b/apps/server/src/vcs/GitVcsDriverCore.test.ts index d9b816563c6..19c5de75631 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.test.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.test.ts @@ -153,23 +153,22 @@ it.effect("uses stable diagnostics for every parsed non-repository command", () }).pipe(Effect.provide(layer)); }); -it.effect( - "returns consistent default branch and origin remote across repeated local status calls", - () => - Effect.gen(function* () { - const driver = yield* GitVcsDriver.GitVcsDriver; - const cwd = yield* makeTmpDir(); - const { initialBranch } = yield* initRepoWithCommit(cwd); +it.effect("invalidates origin remote cache when a driver mutation adds origin", () => + Effect.gen(function* () { + const driver = yield* GitVcsDriver.GitVcsDriver; + const cwd = yield* makeTmpDir(); + const remote = yield* makeTmpDir("git-vcs-driver-remote-"); + yield* initRepoWithCommit(cwd); + yield* git(remote, ["init", "--bare"]); + + const before = yield* driver.statusDetailsLocal(cwd); + assert.equal(before.hasOriginRemote, false); - const a = yield* driver.statusDetailsLocal(cwd); - const b = yield* driver.statusDetailsLocal(cwd); + yield* driver.ensureRemote({ cwd, preferredName: "origin", url: remote }); - assert.equal(a.isRepo, true); - assert.equal(a.branch, initialBranch); - assert.equal(a.isDefaultBranch, b.isDefaultBranch); - assert.equal(a.hasOriginRemote, b.hasOriginRemote); - assert.equal(a.hasWorkingTreeChanges, false); - }).pipe(Effect.provide(TestLayer)), + const after = yield* driver.statusDetailsLocal(cwd); + assert.equal(after.hasOriginRemote, true); + }).pipe(Effect.provide(TestLayer)), ); it.effect("coalesces concurrent ref pages into one repository snapshot", () => From bb76491763cc725956ea788b1b67eaddf94d3d2b Mon Sep 17 00:00:00 2001 From: UtkarshUsername Date: Fri, 31 Jul 2026 00:54:33 +0530 Subject: [PATCH 5/7] fix(server): key status caches by gitCommonDir instead of cwd Cache factories already use gitCommonDir as their key, but the Cache.get call site in readStatusDetailsLocal was passing a normalized cwd path. This meant every status refresh missed the cache (different key) and re-fetched the git subprocesses. Worse, sibling worktree mutations invalidated by gitCommonDir never cleared the cwd-keyed entry. Now resolve repositoryPaths early in readStatusDetailsLocal and pass gitCommonDir as the cache key, matching what the factories expect and what invalidateStatusStaticCaches already uses. --- apps/server/src/vcs/GitVcsDriverCore.ts | 56 +++++++++++++++++++++---- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts index 062ad6c8480..3262758bb10 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.ts @@ -1122,19 +1122,55 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* }; const defaultBranchCache = yield* Cache.makeWith( - (cwd: string) => resolveDefaultBranchName(cwd, "origin"), + (gitCommonDir: string) => + Effect.gen(function* () { + const path = yield* Path.Path; + const fetchCwd = + path.basename(gitCommonDir) === ".git" ? path.dirname(gitCommonDir) : gitCommonDir; + return yield* executeGit( + "GitVcsDriver.statusDetails.defaultBranch", + fetchCwd, + ["--git-dir", gitCommonDir, "symbolic-ref", "refs/remotes/origin/HEAD"], + { allowNonZeroExit: true }, + ).pipe( + Effect.map((result) => { + if (result.exitCode !== 0) return null; + return parseDefaultBranchFromRemoteHeadRef(result.stdout, "origin"); + }), + ); + }), { capacity: 2_048, timeToLive: () => STATUS_DEFAULT_BRANCH_CACHE_TTL, }, ); - const originExistsCache = yield* Cache.makeWith((cwd: string) => originRemoteExists(cwd), { - capacity: 2_048, - timeToLive: () => STATUS_ORIGIN_EXISTS_CACHE_TTL, - }); + const originExistsCache = yield* Cache.makeWith( + (gitCommonDir: string) => + Effect.gen(function* () { + const path = yield* Path.Path; + const fetchCwd = + path.basename(gitCommonDir) === ".git" ? path.dirname(gitCommonDir) : gitCommonDir; + return yield* executeGit( + "GitVcsDriver.statusDetails.originExists", + fetchCwd, + ["--git-dir", gitCommonDir, "remote", "get-url", "origin"], + { allowNonZeroExit: true }, + ).pipe(Effect.map((result) => result.exitCode === 0)); + }), + { + capacity: 2_048, + timeToLive: () => STATUS_ORIGIN_EXISTS_CACHE_TTL, + }, + ); const invalidateStatusStaticCaches = (cwd: string) => Effect.gen(function* () { - const cacheKey = normalizeRepositoryPathsCacheKey(cwd); + const repositoryPaths = yield* resolveRepositoryPaths(cwd).pipe( + Effect.catchTags({ + GitCommandError: (error) => + isMissingGitCwdError(error) ? Effect.succeed(null) : Effect.fail(error), + }), + ); + const cacheKey = repositoryPaths?.gitCommonDir ?? cwd; yield* Cache.invalidate(defaultBranchCache, cacheKey); yield* Cache.invalidate(originExistsCache, cacheKey); }); @@ -1537,7 +1573,13 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* }); } - const statusCacheKey = normalizeRepositoryPathsCacheKey(cwd); + const repositoryPaths = yield* resolveRepositoryPaths(cwd).pipe( + Effect.catchTags({ + GitCommandError: (error) => + isMissingGitCwdError(error) ? Effect.succeed(null) : Effect.fail(error), + }), + ); + const statusCacheKey = repositoryPaths?.gitCommonDir ?? normalizeRepositoryPathsCacheKey(cwd); const [numstatStdout, defaultBranch, hasPrimaryRemote] = yield* Effect.all( [ executeGitWithStableDiagnostics( From d3b9ce588680900762fc1e45f475b9ece1e01ec1 Mon Sep 17 00:00:00 2001 From: UtkarshUsername Date: Fri, 31 Jul 2026 01:36:29 +0530 Subject: [PATCH 6/7] fix(server): address Cursor Bugbot findings on status cache invalidation Three fixes for the status static caches (defaultBranchCache, originExistsCache): 1. Fix fallback key mismatch in invalidateStatusStaticCaches: use normalizeRepositoryPathsCacheKey(cwd) instead of raw cwd to match the key format used by Cache.get in readStatusDetailsLocal. 2. Make invalidation fully infallible: catch all GitCommandError variants from resolveRepositoryPaths instead of only isMissingGitCwdError, ensuring invalidation always runs after mutations even on transient resolve failures. 3. Skip cache when gitCommonDir is unavailable: fall back to inline git execution instead of passing a non-git-dir path as --git-dir to the cache factories. Cursor Bugbot: Invalidation fallback key mismatch (MEDIUM) Cursor Bugbot: Invalidation needs fallible path resolve (MEDIUM) Cursor Bugbot: Fallback key misused as git-dir (MEDIUM) --- apps/server/src/vcs/GitVcsDriverCore.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts index 3262758bb10..764d6a3f0af 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.ts @@ -1165,12 +1165,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* const invalidateStatusStaticCaches = (cwd: string) => Effect.gen(function* () { const repositoryPaths = yield* resolveRepositoryPaths(cwd).pipe( - Effect.catchTags({ - GitCommandError: (error) => - isMissingGitCwdError(error) ? Effect.succeed(null) : Effect.fail(error), - }), + Effect.catchTags({ GitCommandError: () => Effect.succeed(null) }), ); - const cacheKey = repositoryPaths?.gitCommonDir ?? cwd; + const cacheKey = repositoryPaths?.gitCommonDir ?? normalizeRepositoryPathsCacheKey(cwd); yield* Cache.invalidate(defaultBranchCache, cacheKey); yield* Cache.invalidate(originExistsCache, cacheKey); }); @@ -1574,12 +1571,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* } const repositoryPaths = yield* resolveRepositoryPaths(cwd).pipe( - Effect.catchTags({ - GitCommandError: (error) => - isMissingGitCwdError(error) ? Effect.succeed(null) : Effect.fail(error), - }), + Effect.catchTags({ GitCommandError: () => Effect.succeed(null) }), ); - const statusCacheKey = repositoryPaths?.gitCommonDir ?? normalizeRepositoryPathsCacheKey(cwd); + const statusCacheKey = repositoryPaths?.gitCommonDir; const [numstatStdout, defaultBranch, hasPrimaryRemote] = yield* Effect.all( [ executeGitWithStableDiagnostics( @@ -1637,8 +1631,12 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* ); }), ), - Cache.get(defaultBranchCache, statusCacheKey).pipe(Effect.orElseSucceed(() => null)), - Cache.get(originExistsCache, statusCacheKey).pipe(Effect.orElseSucceed(() => false)), + statusCacheKey + ? Cache.get(defaultBranchCache, statusCacheKey).pipe(Effect.orElseSucceed(() => null)) + : resolveDefaultBranchName(cwd, "origin").pipe(Effect.orElseSucceed(() => null)), + statusCacheKey + ? Cache.get(originExistsCache, statusCacheKey).pipe(Effect.orElseSucceed(() => false)) + : originRemoteExists(cwd).pipe(Effect.orElseSucceed(() => false)), ], { concurrency: "unbounded" }, ); From 5ff8cada4d75a753078b2b875227b6921edfcaa1 Mon Sep 17 00:00:00 2001 From: UtkarshUsername Date: Fri, 31 Jul 2026 02:20:54 +0530 Subject: [PATCH 7/7] fix(server): don't cache transient git failures in status lookups Set failure TTL to Duration.zero for defaultBranchCache and originExistsCache so transient git errors aren't held for 5 min. Adds a retry test that proves the cache expires after TTL: caches hasOriginRemote=false via normal read, bypasses invalidation by adding origin through raw git, then advances past the 5-min TTL with TestClock and confirms the next read picks up the new value. --- apps/server/src/vcs/GitVcsDriverCore.test.ts | 27 ++++++++++++++++++++ apps/server/src/vcs/GitVcsDriverCore.ts | 10 ++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/apps/server/src/vcs/GitVcsDriverCore.test.ts b/apps/server/src/vcs/GitVcsDriverCore.test.ts index 19c5de75631..24d53cd4846 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.test.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.test.ts @@ -171,6 +171,33 @@ it.effect("invalidates origin remote cache when a driver mutation adds origin", }).pipe(Effect.provide(TestLayer)), ); +it.effect("re-reads origin remote status after cache TTL expiry and bypassed invalidation", () => + Effect.gen(function* () { + const driver = yield* GitVcsDriver.GitVcsDriver; + const cwd = yield* makeTmpDir(); + const remote = yield* makeTmpDir("git-vcs-driver-remote-"); + yield* initRepoWithCommit(cwd); + yield* git(remote, ["init", "--bare"]); + + // First call caches hasOriginRemote = false (5-min TTL) + assert.equal((yield* driver.statusDetailsLocal(cwd)).hasOriginRemote, false); + + // Add origin via raw git (bypasses invalidation hook) + yield* git(cwd, ["remote", "add", "origin", remote]); + + // Cache still has the stale false (TTL not yet expired) + const stillCached = yield* driver.statusDetailsLocal(cwd); + assert.equal(stillCached.hasOriginRemote, false); + + // Advance past the 5-minute TTL so the cache entry expires + yield* TestClock.adjust("6 minutes"); + + // After expiry, the next call re-executes and picks up the remote + const afterExpiry = yield* driver.statusDetailsLocal(cwd); + assert.equal(afterExpiry.hasOriginRemote, true); + }).pipe(Effect.provide(TestLayer)), +); + it.effect("coalesces concurrent ref pages into one repository snapshot", () => Effect.scoped( Effect.gen(function* () { diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts index 764d6a3f0af..e44dc048634 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.ts @@ -1141,7 +1141,10 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* }), { capacity: 2_048, - timeToLive: () => STATUS_DEFAULT_BRANCH_CACHE_TTL, + timeToLive: Exit.match({ + onSuccess: () => STATUS_DEFAULT_BRANCH_CACHE_TTL, + onFailure: () => Duration.zero, + }), }, ); const originExistsCache = yield* Cache.makeWith( @@ -1159,7 +1162,10 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* }), { capacity: 2_048, - timeToLive: () => STATUS_ORIGIN_EXISTS_CACHE_TTL, + timeToLive: Exit.match({ + onSuccess: () => STATUS_ORIGIN_EXISTS_CACHE_TTL, + onFailure: () => Duration.zero, + }), }, ); const invalidateStatusStaticCaches = (cwd: string) =>