Keep workspace Git refreshes responsive at scale (#2979)

* fix(server): prevent Git watcher fanout stalls

Repository metadata events were refreshing every observed worktree, multiplying Git process submissions and starving workspace create and archive requests behind observation work. Route metadata to the workspaces that depend on it, preserve conservative shared-ref refreshes, and admit interactive lifecycle operations ahead of queued background reads.

* fix(server): preserve Git metadata dependencies
This commit is contained in:
Mohamed Boudra
2026-08-07 18:50:43 +08:00
committed by GitHub
parent a5184fd08a
commit a06e4d60e9
14 changed files with 1569 additions and 57 deletions
+17 -6
View File
@@ -97,11 +97,18 @@ function getRelativePathInsideRoot(root: string, candidate: string): string | nu
const platformPath = compareAsWindows ? nodePath.win32 : nodePath.posix;
const normalizedRoot = normalizePathForComparison(root, compareAsWindows);
const normalizedCandidate = normalizePathForComparison(candidate, compareAsWindows);
const relative = platformPath.relative(normalizedRoot, normalizedCandidate);
const comparableRelative = platformPath.relative(normalizedRoot, normalizedCandidate);
return relative === "" || (!relative.startsWith("..") && !platformPath.isAbsolute(relative))
? relative
: null;
if (
comparableRelative !== "" &&
(comparableRelative.startsWith("..") || platformPath.isAbsolute(comparableRelative))
) {
return null;
}
const casePreservingRoot = normalizePathPreservingCase(root, compareAsWindows);
const casePreservingCandidate = normalizePathPreservingCase(candidate, compareAsWindows);
return platformPath.relative(casePreservingRoot, casePreservingCandidate);
}
function collectPathVariants(value: string): string[] {
@@ -140,15 +147,19 @@ function looksLikeDefiniteWindowsPath(value: string): boolean {
}
function normalizePathForComparison(value: string, compareAsWindows: boolean): string {
const normalized = normalizePathPreservingCase(value, compareAsWindows);
return compareAsWindows ? normalized.toLowerCase() : normalized;
}
function normalizePathPreservingCase(value: string, compareAsWindows: boolean): string {
const platformPath = compareAsWindows ? nodePath.win32 : nodePath.posix;
const comparableValue = compareAsWindows ? stripWindowsNamespacePrefix(value) : value;
const platformNormalized = platformPath.normalize(comparableValue);
const normalized = stripTrailingSeparators(
return stripTrailingSeparators(
platformNormalized,
platformPath.parse(platformNormalized).root,
compareAsWindows,
);
return compareAsWindows ? normalized.toLowerCase() : normalized;
}
function stripWindowsNamespacePrefix(value: string): string {