diff --git a/apps/server/src/vcs/GitVcsDriverCore.ts b/apps/server/src/vcs/GitVcsDriverCore.ts index dabcd1112ab06..e23b926305911 100644 --- a/apps/server/src/vcs/GitVcsDriverCore.ts +++ b/apps/server/src/vcs/GitVcsDriverCore.ts @@ -1694,6 +1694,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* readonly count: number; readonly retryAt: number; readonly detail: string; + readonly cause: GitCommandError | undefined; } >(); const statusRemoteRefreshFailureKey = (cacheKey: StatusRemoteRefreshCacheKey) => @@ -3645,7 +3646,10 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* ).pipe( Effect.catchTags({ GitCommandError: (error) => - Effect.succeed({ unavailable: `Could not list untracked files: ${error.detail}` }), + Effect.succeed({ + unavailable: `Could not list untracked files: ${error.detail}`, + cause: error, + }), }), ); if ("unavailable" in untracked) return untracked; @@ -3769,6 +3773,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* command: "git ls-files", cwd, detail: remembered.detail, + ...(remembered.cause === undefined ? {} : { cause: remembered.cause }), }); } // Empty status can mean untracked files are hidden; retain the full scan. @@ -3783,6 +3788,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* (yield* Clock.currentTimeMillis) + Math.min(UNTRACKED_TOTALS_RETRY_MIN_MS * 2 ** (count - 1), UNTRACKED_TOTALS_RETRY_MAX_MS), detail: untracked.unavailable, + cause: "cause" in untracked ? untracked.cause : undefined, }); if (untrackedTotalsFailures.size > STATUS_UPSTREAM_REFRESH_CACHE_CAPACITY) { const oldestKey = untrackedTotalsFailures.keys().next().value; @@ -3793,6 +3799,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* command: "git ls-files", cwd, detail: untracked.unavailable, + ...("cause" in untracked ? { cause: untracked.cause } : {}), }); } untrackedTotalsFailures.delete(cwd);