Keep the daemon responsive during Git queue pressure (#3945)

* fix(server): keep Git pressure from stalling daemon

Git process starts were refilled synchronously, so slow process spawning could monopolize the main loop long enough to trip connection liveness checks. Admit one process per event-loop turn and expose refresh/fetch provenance in runtime queue metrics.

* perf(server): avoid delaying isolated Git commands

Start the first command immediately when the scheduler is idle. Backlog admission and completion-driven refills still yield between spawns, preserving daemon liveness without adding a turn to normal sequential Git traffic.

* fix(server): keep Git admission outside fake clocks

Subprocess admission is event-loop ordering rather than simulated wall-clock behavior. Use the native Node immediate so service tests can fake debounce timers without deadlocking queued real Git processes.

* refactor(server): bind Git command provenance explicitly

* test(server): expect bound Git fetch runner
This commit is contained in:
Mohamed Boudra
2026-08-28 10:25:20 +02:00
committed by GitHub
parent fe803f6e70
commit fb67d2cdc8
12 changed files with 429 additions and 122 deletions
@@ -409,6 +409,20 @@ describe("runGitCommand", () => {
]);
});
it("binds queue provenance to a Git command runner", async () => {
const { createRunGitCommand, snapshotGitCommandRuntimeMetrics } = await loadRunGitCommand(1);
enqueueSpawnBehaviors({ stdoutData: "ok" });
const runWorkspaceRefreshGitCommand = createRunGitCommand("workspace-refresh:watch");
await runWorkspaceRefreshGitCommand(["status"], { cwd: process.cwd() });
expect(snapshotGitCommandRuntimeMetrics()).toMatchObject({
provenanceTop: [["workspace-refresh:watch", 1]],
pendingProvenanceTop: [],
activeProvenanceTop: [],
});
});
it("resolves truncated stdout, caps output, and kills the child process", async () => {
const { runGitCommand } = await loadRunGitCommand(1);